интеграция mule-esb ajax с проверкой орфографии google

Я скачал последнюю версию mule studio с сайта mulesoft и начал работать над первым примером в

Windows 8: 64-битная.

Версия Mule: 3.4.0

JRE: 7

Название проекта указано как: test

Дата сборки: 201305141336

Когда я нажимаю эту ссылку в браузере, появляется следующая ошибка:

https://www.google.com/tbproxy/spell?lang=en

This XML file does not appear to have any style information associated with it. The document tree is shown below.

      <spellresult error="1"/>

мой xml файл:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:ajax="http://www.mulesoft.org/schema/mule/ajax" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/ajax http://www.mulesoft.org/schema/mule/ajax/current/mule-ajax.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
    <ajax:connector name="AjaxConnector" serverUrl="http://127.0.0.1:8090/Ajax" resourceBase="src/main/app/docroot" jsonCommented="true" doc:name="Ajax"/>
    <flow name="testFlow1" doc:name="testFlow1">
        <ajax:inbound-endpoint channel="services/echo" responseTimeout="10000" doc:name="Ajax Channel" connector-ref="AjaxConnector"/>
        <mulexml:object-to-xml-transformer doc:name="Convert JS to XML"/>
        <mulexml:xslt-transformer maxIdleTransformers="2" maxActiveTransformers="5" doc:name="Convert XML structure" xsl-file="F:\project\workspace\mulestudio\test\src\main\resources\transform.xsl"/>
        <http:outbound-endpoint exchange-pattern="request-response" host="www.google.com/tbproxy/spell?lang=en" port="80" method="POST" doc:name="Google API" contentType="text/xml"/>
        <echo-component doc:name="Echo to Console"/>
    </flow>
</mule>

person AKB    schedule 02.06.2013    source источник


Ответы (1)


Вы получаете эту ошибку, потому что при просмотре https://www.google.com/tbproxy/spell?lang=en вы отправляете HTTP-запрос GET на ресурс, который принимает HTTP-запросы POST.

Попробуйте:

curl -H "Content-Type: application/xml" \
     -d '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="0"><text>look at the butterfli</text></spellrequest>' \
     https://www.google.com/tbproxy/spell?lang=en

и вы увидите варианты написания от Google.

person David Dossot    schedule 03.06.2013