2016-08-17 3 views
0

Я пытаюсь использовать веб-сервис, который есть в системе мэйнфреймов. Я создал окурки из WSDL и генерируется код конечной точки, как что-то вроде нижеОтвет клиента SOAP

@WebMethod(operationName = "ADDWEBSOperation") 
    @RequestWrapper(localName = "ADDWEBSOperation", targetNamespace = "http://www.*****.******.Request.com", className = "com.*****.*****.addwebs.ProgramInterface") 
    @ResponseWrapper(localName = "ADDWEBSOperationResponse", targetNamespace = "http://www.***.***.Response.com", className = "com.*****.*****.addwebs.ProgramInterface") 
    public void addwebsOperation(
     @WebParam(name = "Num1", targetNamespace = "http://www.***.****.Request.com", mode = WebParam.Mode.INOUT) 
     Holder<Integer> num1, 
     @WebParam(name = "Num2", targetNamespace = "http://www.*****.*****.Request.com", mode = WebParam.Mode.INOUT) 
     Holder<Integer> num2, 
     @WebParam(name = "Result", targetNamespace = "http://www.*****.*****.Request.com", mode = WebParam.Mode.INOUT) 
     Holder<Integer> result); 

} 

Это показывает, что это служба конечных точек не возвращается ничего (Пустота).

Его простой калькулятор, в котором добавлены Num1 и Num2 и переместите его на Result.

Теперь, если я использую WSDL в SOAP UI, это дает мне правильный ответ.

Я сделал что-то вроде этого.

public class TestClass { 

    public static void main(String[] args) { 
    ADDWEBSService srvc = new ADDWEBSService(); 
     Holder<Integer> n2 = new Holder<Integer>(); 
     Holder<Integer> n1 = new Holder<Integer>(); 
     Holder<Integer> rs = new Holder<Integer>(); 
     n1.value = 10; 
     n2.value = 2; 
     srvc.getADDWEBSPort().addwebsOperation(n1, n2, rs); 
    } 
} 

Я не понимаю, как я могу получить результат. Мой Сервисный вызов является достаточно успешным, но мне нужна помощь в отображении значения ответа (rs) здесь.

Вот спинет из WSDL.

<?xml version="1.0" ?> 
<definitions targetNamespace="http://www.***.***.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:reqns="http://www.***.***.Request.com" xmlns:resns="http://www.***.***.Response.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.***.***.com"> 
    <types> 
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.***.***.Request.com" xmlns:tns="http://www.***.***.Request.com"> 
     <xsd:annotation> 
      <xsd:documentation source="http://www.***.com/sftware/***/cics/annotations">This schema was generated by the CICS Web services assistant.</xsd:documentation> 
     </xsd:annotation> 
     <xsd:annotation> 
      <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.mappingLevel=3.0</xsd:appinfo> 
     </xsd:annotation> 
     <xsd:complexType abstract="false" block="#all" final="#all" mixed="false" name="ProgramInterface"> 
      <xsd:sequence> 
       <xsd:element name="Num1" nillable="false"> 
        <xsd:simpleType> 
        <xsd:annotation> 
         <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.synchronized=false</xsd:appinfo> 
        </xsd:annotation> 
        <xsd:restriction base="xsd:unsignedShort"> 
         <xsd:maxInclusive value="99"/> 
         <xsd:minInclusive value="0"/> 
        </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 
       <xsd:element name="Num2" nillable="false"> 
        <xsd:simpleType> 
        <xsd:annotation> 
         <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.synchronized=false</xsd:appinfo> 
        </xsd:annotation> 
        <xsd:restriction base="xsd:unsignedShort"> 
         <xsd:maxInclusive value="99"/> 
         <xsd:minInclusive value="0"/> 
        </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 
       <xsd:element name="Result" nillable="false"> 
        <xsd:simpleType> 
        <xsd:annotation> 
         <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.synchronized=false</xsd:appinfo> 
        </xsd:annotation> 
        <xsd:restriction base="xsd:unsignedShort"> 
         <xsd:maxInclusive value="9999"/> 
         <xsd:minInclusive value="0"/> 
        </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 
      </xsd:sequence> 
     </xsd:complexType> 
     <xsd:element name="ADDWEBSOperation" nillable="false" type="tns:ProgramInterface"/> 
     </xsd:schema> 
     <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.***.***.Response.com" xmlns:tns="http://www.***.***.Response.com"> 
     <xsd:annotation> 
      <xsd:documentation source="http://www.***.com/sftware/***/cics/annotations">This schema was generated by the CICS Web services assistant.</xsd:documentation> 
     </xsd:annotation> 
     <xsd:annotation> 
      <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.mappingLevel=3.0</xsd:appinfo> 
     </xsd:annotation> 
     <xsd:complexType abstract="false" block="#all" final="#all" mixed="false" name="ProgramInterface"> 
      <xsd:sequence> 
       <xsd:element name="Num1" nillable="false"> 
        <xsd:simpleType> 
        <xsd:annotation> 
         <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.synchronized=false</xsd:appinfo> 
        </xsd:annotation> 
        <xsd:restriction base="xsd:unsignedShort"> 
         <xsd:maxInclusive value="99"/> 
         <xsd:minInclusive value="0"/> 
        </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 
       <xsd:element name="Num2" nillable="false"> 
        <xsd:simpleType> 
        <xsd:annotation> 
         <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.synchronized=false</xsd:appinfo> 
        </xsd:annotation> 
        <xsd:restriction base="xsd:unsignedShort"> 
         <xsd:maxInclusive value="99"/> 
         <xsd:minInclusive value="0"/> 
        </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 
       <xsd:element name="Result" nillable="false"> 
        <xsd:simpleType> 
        <xsd:annotation> 
         <xsd:appinfo source="http://www.***.com/sftware/***/cics/annotations"> 
com.***.cics.wsdl.properties.synchronized=false</xsd:appinfo> 
        </xsd:annotation> 
        <xsd:restriction base="xsd:unsignedShort"> 
         <xsd:maxInclusive value="9999"/> 
         <xsd:minInclusive value="0"/> 
        </xsd:restriction> 
        </xsd:simpleType> 
       </xsd:element> 
      </xsd:sequence> 
     </xsd:complexType> 
     <xsd:element name="ADDWEBSOperationResponse" nillable="false" type="tns:ProgramInterface"/> 
     </xsd:schema> 
    </types> 
    <message name="ADDWEBSOperationResponse"> 
     <part element="resns:ADDWEBSOperationResponse" name="ResponsePart"/> 
    </message> 
    <message name="ADDWEBSOperationRequest"> 
     <part element="reqns:ADDWEBSOperation" name="RequestPart"/> 
    </message> 
    <portType name="ADDWEBSPort"> 
     <operation name="ADDWEBSOperation"> 
     <input message="tns:ADDWEBSOperationRequest" name="ADDWEBSOperationRequest"/> 
     <output message="tns:ADDWEBSOperationResponse" name="ADDWEBSOperationResponse"/> 
     </operation> 
    </portType> 
    <binding name="ADDWEBSHTTPSoapBinding" type="tns:ADDWEBSPort"> 
     <!-- This soap:binding indicates the use of SOAP 1.1 --> 
     <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
     <operation name="ADDWEBSOperation"> 
     <soap:operation soapAction="" style="document"/> 
     <input name="ADDWEBSOperationRequest"> 
      <soap:body parts="RequestPart" use="literal"/> 
     </input> 
     <output name="ADDWEBSOperationResponse"> 
      <soap:body parts="ResponsePart" use="literal"/> 
     </output> 
     </operation> 
    </binding> 
    <service name="ADDWEBSService"> 
     <port binding="tns:ADDWEBSHTTPSoapBinding" name="ADDWEBSPort"> 
     <!-- This soap:address indicates the location of the Web service over HTTP. 
       Please replace "my-server" with the TCPIP host name of your CICS region. 
       Please replace "my-port" with the port number of your CICS TCPIPSERVICE. --> 
     <soap:address location="http://**.**.*.***:****/addwebs"/> 
     <!-- This soap:address indicates the location of the Web service over HTTPS. --> 
     <!-- <soap:address location="https://my-server:my-port/addwebs"/> --> 
     <!-- This soap:address indicates the location of the Web service over WebSphere MQSeries. 
       Please replace "my-queue" with the appropriate queue name. --> 
     <!-- <soap:address location="jms:/queue?destination=my-queue&amp;connectionFactory=()&amp;targetService=/addwebs&amp;initialContextFactory=com.***.mq.jms.Nojndi" /> --> 
     </port> 
    </service> 
</definitions> 
+0

Я не уверен, что я вас понимаю. Служба выполняется без ошибок, а значение «rs.value» равно null? Вы можете распечатать его с помощью 'System.out.println (rs.value)' – pedrofb

+0

Да .. не только rs.value также n1.value и n2.value будет null после выполнения службы – Geek

+0

Можете ли вы опубликовать фрагменты xsd который показывает объект, который вы возвращаете? – Miles

ответ

0

Я решил эту проблему, создав XML-запрос SOAP и отправив его через HTTPConnection и получив ответ XML. Получение результата было невозможным с использованием заглушек, сгенерированных из WSDL. sO я выбрал этот метод

Смежные вопросы