2

如果使用样品axis2Server服务非常好。但是当我使用 javax 创建自己的 Web 服务时,我遇到了问题。

我使用 wso2 esb 4.60 默认配置

网络服务:

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
public class Lpu {
    public boolean scheduleAnAppointment(@WebParam(name = "time") Integer time) {
        return true;
    }
}

启动网络服务:

import javax.xml.ws.Endpoint;

public class Server {
    public static void main(String[] args)
    {
        Endpoint.publish("http://localhost:8090/WebServices/lpu", new Lpu());
    }
} 

配置esb:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <sequence name="main">
      <in>
         <log level="full"/>
         <send>
            <endpoint>
               <address uri="http://localhost:8090/WebServices/lpu"/>
            </endpoint>
         </send>
      </in>
      <out>
         <log level="full"/>
         <send/>
      </out>
   </sequence>
</definitions>

回复:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <axis2ns1:binary xmlns:axis2ns1="http://ws.apache.org/commons/ns/payload">PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxTOkVudmVsb3BlIHhtbG5zOlM9Imh0dHA6Ly9zY2hlbWFzLnhtbHNvYXAub3JnL3NvYXAvZW52ZWxvcGUvIj48UzpCb2R5PjxuczI6c2NoZWR1bGVBbkFwcG9pbnRtZW50UmVzcG9uc2UgeG1sbnM6bnMyPSJodHRwOi8vZmVyLndlYnNlcnZpY2UvIj48cmV0dXJuPmZhbHNlPC9yZXR1cm4+PC9uczI6c2NoZWR1bGVBbkFwcG9pbnRtZW50UmVzcG9uc2U+PC9TOkJvZHk+PC9TOkVudmVsb3BlPg==</axis2ns1:binary>
   </soapenv:Body>
</soapenv:Envelope>

我想得到:

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:scheduleAnAppointmentResponse xmlns:ns2="http://lpu.webservice/">
         <return>true</return>
      </ns2:scheduleAnAppointmentResponse>
   </S:Body>
</S:Envelope>

我的请求

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:fer="http://lpu.webservice/">
   <soapenv:Header/>
   <soapenv:Body>
      <lpu:scheduleAnAppointment>
         <time>12</time>
      </lpu:scheduleAnAppointment>
   </soapenv:Body>
</soapenv:Envelope>
4

2 回答 2

1

ESB 4.6.0 发布时带有直通传输,它不构建消息。因此,如果您在序列中使用日志中介,您将获得二进制响应。但是在客户端,您应该以首选格式收到您的回复。

如果您切换到 NIO 传输,您还可以获得实际的消息负载。为此,您需要在axis2配置(axis2.conf)中编辑传输发送器和接收器

于 2013-06-10T13:51:05.253 回答
1

更改axis2.xmlaxis2_nhttp.xml更改 /repository/conf/carbon.xml

<ConfigurationFile>${carbon.home}/repository/conf/axis2/axis2_nhttp.xml</ConfigurationFile>

解密有效载荷的另一个建议:

WSO2 以二进制形式响应有效载荷

于 2014-07-18T19:43:43.257 回答