问题
I got a job that I have to generate WS client from WSDL to communicate with server. I use WSImport(JAX-WS) to do the job because it seems less conflicts to different server.
<?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>
Then I'm using the following code to post and get my reply
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());
After exported them as a WAR, this code works good on Tomcat server and prints what I want. But when I put it onto Websphere, it somehow broken and prints Module: null
and Exponent: null
to me? HOW??
My goal is to make it work on WAS, but this issue strikes me hard with no exception messages(Even I used Exception
to try to catch). Does anyone know how to fix this issue on WAS?
来源:https://stackoverflow.com/questions/41719428/jax-ws-didnt-get-response-on-websphere-8-5