Java JAX-WS没有';无法在WebSphere8.5上获得响应
我得到了一项工作,我必须从WSDL生成WS-client以与服务器通信。我使用WSImport(JAX-WS)来完成这项工作,因为对于不同的服务器来说,冲突似乎更少Java JAX-WS没有';无法在WebSphere8.5上获得响应,java,web-services,tomcat,soap,websphere,Java,Web Services,Tomcat,Soap,Websphere,我得到了一项工作,我必须从WSDL生成WS-client以与服务器通信。我使用WSImport(JAX-WS)来完成这项工作,因为对于不同的服务器来说,冲突似乎更少 <?xml version="1.0" encoding="UTF-8" standalone="no"?> <wsdl:definitions xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.o
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.openuri.org/"> <wsdl:types>
<s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:ope="http://www.openuri.org/" elementFormDefault="qualified" targetNamespace="http://www.openuri.org/">
<s:element name="getRSAPublicKey">
<s:complexType>
<s:sequence>
<s:element name="length" type="s:string" maxOccurs="1" minOccurs="0"></s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getRSAPublicKeyResponse">
<s:complexType>
<s:sequence>
<s:element name="getRSAPublicKeyResult" type="ope:RSAPublicKeyResponse" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="RSAPublicKeyResponse">
<s:sequence>
<s:element name="module" type="s:string"
minOccurs="0" />
<s:element name="exponent" type="s:string"
minOccurs="0" />
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="getRSAPublicKeySoapIn">
<wsdl:part element="s0:getRSAPublicKey" name="parameters" />
</wsdl:message>
<wsdl:message name="getRSAPublicKeySoapOut">
<wsdl:part element="s0:getRSAPublicKeyResponse" name="parameters" />
</wsdl:message>
<wsdl:portType name="TestClientSoapPortType">
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>
</jaxws:bindings>
<wsdl:operation name="getRSAPublicKey">
<wsdl:documentation>Web service to get RSA public key</wsdl:documentation>
<wsdl:input message="s0:getRSAPublicKeySoapIn" />
<wsdl:output message="s0:getRSAPublicKeySoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestClientSoapBinding"
type="s0:TestClientSoapPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getRSAPublicKey">
<soap:operation
soapAction="http://www.openuri.org/getRSAPublicKey" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestClient">
<wsdl:port binding="s0:TestClientSoapBinding" name="TestClientSoap">
<soap:address location="https://localhost:8888/TestClientWS/TestClient.jws"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
将它们导出为WAR后,该代码在Tomcat服务器上运行良好,并打印出我想要的内容。但当我把它放到Websphere上时,它不知怎么地坏了,并向我打印了Module:null
和Exponent:null
?怎么做
我的目标是让它在WAS上工作,但这个问题给我留下了深刻的印象,没有异常消息(甚至我使用了
exception
尝试捕捉)。有人知道如何解决WAS上的此问题吗?您必须查看服务器端的日志,看看发生了什么。您可能在服务中有一些错误,这就是您返回null的原因?你是说我的客户端连接到的服务器?他们说他们确实给出了响应,我可以在tomcat上运行此客户端时得到它们。因此,也许可以比较tomcat和WAS发送/接收的xml soap消息,看看是否有任何差异。嗯,我不确定如何在发送前截获消息,或者获取我在Jax-WS处理之前收到的原始消息。有什么java编程方法可以做到这一点吗?例如wireshark,您还可以启用WebSphere端的跟踪检查。尝试设置com.ibm.ws.webservices.trace.MessageTrace=finest:com.ibm.ws.webservices。engine.Message=finest
您必须查看服务器端的日志,看看发生了什么。您可能在服务中有一些错误,这就是您返回null的原因?你是说我的客户端连接到的服务器?他们说他们确实给出了响应,我可以在tomcat上运行此客户端时得到它们。因此,也许可以比较tomcat和WAS发送/接收的xml soap消息,看看是否有任何差异。嗯,我不确定如何在发送前截获消息,或者获取我在Jax-WS处理之前收到的原始消息。有什么java编程方法可以做到这一点吗?例如wireshark,您还可以启用WebSphere端的跟踪检查。尝试设置com.ibm.ws.webservices.trace.MessageTrace=finest:com.ibm.ws.webservices。engine.Message=finest
TestClient tClient = new TestClient(new URL("http://localhost/testws.wsdl"));
TestClientSoapPortType tcSPT = tClient.getTestClientSoap();
GetRSAPublicKey getRSAPublicKey = new GetRSAPublicKey();
getRSAPublicKey.setLength("1024");
GetRSAPublicKeyResponse resp = tcSPT.getRSAPublicKey(getRSAPublicKey);
out.println("Module: " + resp.getGetRSAPublicKeyResult().getModule());
out.println("Exponent: " + resp.getGetRSAPublicKeyResult().getExponent());