JAX-WS在Websphere 8.5上没有得到响应

时间:2017-01-18 12:27:06

标签: java web-services tomcat soap websphere

我得到了一份工作,我必须从WSDL生成WS客户端以与服务器通信。我使用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.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>

然后我使用以下代码发布并获得我的回复

        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());

将它们导出为WAR后,此代码在Tomcat服务器上运行良好并打印出我想要的内容。但当我把它放到Websphere上时,它会以某种方式破坏并打印Module: nullExponent: null给我? HOW ??

我的目标是让它在WAS上运行,但是这个问题让我很难,没有异常消息(即使我使用Exception试图捕获)。有谁知道如何在WAS上解决这个问题?

0 个答案:

没有答案