【问题标题】:WSO2 response binary why?WSO2 响应二进制为什么?
【发布时间】:2015-12-02 00:03:41
【问题描述】:

如果使用样品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>

【问题讨论】:

    标签: wso2 esb wso2esb


    【解决方案1】:

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

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

    【讨论】:

    • 如果我使用默认的简单axis2服务docs.wso2.org/wiki/display/ESB451/…codepaste.ru/14606并请求codepaste.ru/14604那么一切都很好,为什么?
    • 如果我从 中删除所有内容并留下 则为 true 运行
    • 这很简单 web-service 这很简单 config esb wso。为什么返回二进制?
    • transportReceiver - PassThroughHttpListener 替换为 HttpCoreNIOListener,transportSender - PassThroughHttpSender 替换为 HttpCoreNIOSender。谢谢
    【解决方案2】:

    axis2.xml 更改为axis2_nhttp.xml /repository/conf/carbon.xml改变:

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

    另一个解密payload的建议:

    WSO2 responds payload in binary

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 1970-01-01
      • 2010-12-11
      • 2014-09-24
      • 1970-01-01
      • 1970-01-01
      • 2012-06-16
      相关资源
      最近更新 更多