Search code examples
web-servicessoapwsdlapache-axis

How To Get Response XML From Generated Stub


I'm using Axis2's wsdl2java to generate a stub for the following WSDL (please note that if names don't match up, it's probably from my obfuscation of the code):

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://test.com/saucy/schemas" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://test.com/saucy/definitions" targetNamespace="http://test.com/saucy/definitions">
  <wsdl:types>
    <xs:schema xmlns:wtfd="http://test.com/saucy/schemas" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://test.com/saucy/schemas">
    <xs:element name="fubarmanagerRequest">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="1" name="addUsers" type="wtfd:addUsersType"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="addUsersType">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" name="user" type="wtfd:userType"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="userType">
        <xs:sequence>
            <xs:element maxOccurs="1" minOccurs="1" name="emailAddress" type="xs:string"/>
            <xs:element maxOccurs="1" minOccurs="1" name="password" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="fubarmanagerRequest">
    <wsdl:part element="sch:fubarmanagerRequest" name="fubarmanagerRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="wtfsaucy">
    <wsdl:operation name="fubarmanager">
      <wsdl:input message="tns:fubarmanagerRequest" name="fubarmanagerRequest">
    </wsdl:input>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="wtfsaucySoap11" type="tns:wtfsaucy">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="fubarmanager">
      <soap:operation soapAction=""/>
      <wsdl:input name="fubarmanagerRequest">
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="wtfsaucyService">
    <wsdl:port binding="tns:wtfsaucySoap11" name="wtfsaucySoap11">
      <soap:address location="http://localhost:8080/mailerManagerService/"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

However, it seems like the generated stub isn't providing a means for me to retrieve the response XML:

/**
  * Auto generated method signature
  * 
  */
public void  fubarManager(com.obfuscated.fubarRequest fubarRequest0

) throws java.rmi.RemoteException

I'm able to get the response XML in SoapUI, but How can I retrieve it through the web generated service client code? Is something missing from my WSDL? Are there additional options I should be passing to wsdl2java?


Solution

  • I had to make sure my WSDL included a section for the response message:

    <wsdl:portType name="wtfDirect">
      <wsdl:operation name="MailManager">
        <wsdl:input message="tns:MailManagerRequest" name="MailManagerRequest">
        </wsdl:input>
        <wsdl:output message="tns:MailManagerResponse" name="MailManagerResponse">
        </wsdl:output>
      </wsdl:operation>
    </wsdl:portType>