@Tequilla

Как исправить ошибку «Exception occured while processing the HTTP response of a two-way request»?

Всем привет!

Не так давно я начал знакомиться языком описания бизнес-процессов BPEL и веб-сервисами. Для целей обучения я создал простенький REST WCF сервис, который получает строку текста (используя HTTP Post запрос) и возвращает другую строку, как результат работы веб-сервиса. Сервис работает отлично и выдает результаты.

Однако при попытке вызвать этот сервис из BPEL-процесса я получаю следующую ошибку:

21:25:58,625 ERROR [ExternalService] [Service: {http://tempuri.org/}RestService, Port: RestServicePort, <b>Operation: GetData] Exception occured while processing the HTTP response of a two-way request. </b>mexId= hqejbhcnphr96pu7vwbw8r
java.lang.NullPointerException
    at org.apache.ode.axis2.httpbinding.HttpMethodConverter.createPartElement(HttpMethodConverter.java:390)
    at org.apache.ode.axis2.httpbinding.HttpMethodConverter.parseHttpResponse(HttpMethodConverter.java:510)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$TwoWayCallable._2xx_success(HttpExternalService.java:362)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$TwoWayCallable.access$100(HttpExternalService.java:298)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$TwoWayCallable$1.call(HttpExternalService.java:310)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$TwoWayCallable$1.call(HttpExternalService.java:306)
    at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:289)
    at org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(SimpleScheduler.java:244)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$TwoWayCallable.processResponse(HttpExternalService.java:306)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$OneWayCallable.call(HttpExternalService.java:258)
    at org.apache.ode.axis2.httpbinding.HttpExternalService$OneWayCallable.call(HttpExternalService.java:227)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
21:25:58,655 ERROR [INVOKE] Failure during invoke: Exception occured while processing the HTTP response of a two-way request. mexId= hqejbhcnphr96pu7vwbw8r
21:25:58,656 INFO  [BpelRuntimeContextImpl] ActivityRecovery: Registering activity 11, failure reason: Exception occured while processing the HTTP response of a two-way request. mexId= hqejbhcnphr96pu7vwbw8r on channel 21


Самое интересное, что веб-сервис получает http-запрос (т.е. сервис запускается), однако входной параметр почему-то равен NULL, хотя я перед отправкой я его инициализирую.
Буду очень признателен, если кто-то подскажет, как можно решить эту проблему. Заранее благодарен.

Сервис имеет следующий интерфейс:
public interface IRestService
{

    [OperationContract]
    [WebInvoke(UriTemplate = "GetData", RequestFormat=WebMessageFormat.Xml)]
    string GetData(string value);
}


Следующий кусок кода описывает бизнес-логику процесса, который получает строку текста, отправляет ее Rest-сервису, получает ответ и возвращает ее пользователю:
<bpel:sequence>   
 <!-- Receive input from requester. 
             Note: This maps to operation defined in restClient.wsdl 
             -->
        <bpel:receive name="receiveInput" partnerLink="client"
                 portType="tns:restClient"
                 operation="process" variable="input"
                 createInstance="yes"/>

        <!-- Generate reply to synchronous request -->


        <bpel:assign validate="no" name="Assign">
            <bpel:copy>
                <bpel:from><bpel:literal><tns:GetData xmlns:tns="http://tempuri.org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:value>tns:value</tns:value>
</tns:GetData>
</bpel:literal></bpel:from>
                <bpel:to variable="RestServicePLRequest" part="parameters"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from part="payload" variable="input">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]></bpel:query>
                </bpel:from>
                <bpel:to part="parameters" variable="RestServicePLRequest">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:value]]></bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:invoke name="Invoke" partnerLink="RestServicePL" operation="GetData" portType="ns:IRestService" inputVariable="RestServicePLRequest" outputVariable="RestServicePLResponse"></bpel:invoke>


        <bpel:assign validate="no" name="Assign1">
            <bpel:copy>
                <bpel:from><bpel:literal><tns:restClientResponse xmlns:tns="http://RestInvoker.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <tns:result>tns:result</tns:result>
</tns:restClientResponse>
</bpel:literal></bpel:from>
                <bpel:to variable="output" part="payload"></bpel:to>
            </bpel:copy>
            <bpel:copy>
                <bpel:from part="parameters" variable="RestServicePLResponse">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:GetDataResult]]></bpel:query>
                </bpel:from>
                <bpel:to part="payload" variable="output">
                    <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
                </bpel:to>
            </bpel:copy>
        </bpel:assign>
        <bpel:reply name="replyOutput" partnerLink="client" portType="tns:restClient" operation="process" variable="output" />
    </bpel:sequence>
  • Вопрос задан
  • 3079 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы