4 Replies Latest reply on Sep 20, 2007 7:35 AM by Bernhard Pauler

    Problem with methods returning an attachment

    Bernhard Pauler Newbie

      I have a nasty problem.

      Some methods of my web service should return an attachment.

      I start with a handwritten WSDL file and generate the necessary artifacts and descriptors using JAX-RPC tools.

      There are no warning or error messages at deploy time.

      An error occurs after invoking the method:
      16:27:34,485 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
      org.jboss.ws.WSException: Operation does not have a return value: {http://myservice.mycompany.com/myservice}getTemplate

      I can't figure out why JBoss behaves that way - can somebody help me with this?

      Thanks,

      Bernhard

      Here are of the relevant files:

      MyService.wsdl:

      <?xml version="1.0" encoding="utf-8"?>
      
      <definitions name="MyService"
       xmlns ="http://schemas.xmlsoap.org/wsdl/"
       xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:mime ="http://schemas.xmlsoap.org/wsdl/mime/"
       xmlns:xsd ="http://www.w3.org/2001/XMLSchema"
       xmlns:tns ="http://myservice.mycompany.com/myservice"
       targetNamespace="http://myservice.mycompany.com/myservice">
      
       <types>
       <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://myservice.mycompany.com/myservice">
       <element name="getTemplate">
       <complexType>
       <sequence>
       <element name="templateId" type="xsd:int"/>
       </sequence>
       </complexType>
       </element>
       <element name="MyServiceFault">
       <complexType>
       <sequence>
       <element name="errorCode" type="xsd:string"/>
       <element name="errorMessage" type="xsd:string"/>
       </sequence>
       </complexType>
       </element>
       </schema>
       </types>
      
       <message name="getTemplateRequest">
       <part name="parameters" element="tns:getTemplate"/>
       </message>
       <message name="getTemplateResponse">
       <part name="template" type="xsd:hexBinary"/>
       </message>
       <message name="MyServiceFaultMessage">
       <part name="fault" element="tns:MyServiceFault"/>
       </message>
      
       <portType name="MyServiceEndpoint">
       <operation name="getTemplate">
       <input message="tns:getTemplateRequest"/>
       <output message="tns:getTemplateResponse"/>
       <fault name="MyServiceFault" message="tns:MyServiceFaultMessage"/>
       </operation>
       </portType>
      
       <binding name="MyServiceEndpointBinding" type="tns:MyServiceEndpoint">
       <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="getTemplate">
       <input>
       <soap:body use="literal"/>
       </input>
       <output>
       <mime:multipartRelated>
       <mime:part>
       <soap:body use="literal"/>
       </mime:part>
       <mime:part>
       <mime:content part="template" type="application/*"/>
       </mime:part>
       </mime:multipartRelated>
       </output>
       <fault name="MyServiceFault">
       <soap:fault name="MyServiceFault" use="literal"/>
       </fault>
       </operation>
       </binding>
      
       <service name="MyService">
       <port name="MyServiceEndpointPort" binding="tns:MyServiceEndpointBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
       </port>
       </service>
      
      </definitions>


      jaxrpc-mapping.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
      <package-mapping>
      <package-type>com.mycompany.myservice</package-type>
      <namespaceURI>http://myservice.mycompany.com/myservice</namespaceURI>
      </package-mapping>
      <java-xml-type-mapping>
      <java-type>com.mycompany.myservice.MyServiceFault</java-type>
      <anonymous-type-qname xmlns:typeNS="http://myservice.mycompany.com/myservice">typeNS:>MyServiceFault</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>errorCode</java-variable-name>
      <xml-element-name>errorCode</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>errorMessage</java-variable-name>
      <xml-element-name>errorMessage</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>com.mycompany.myservice.GetTemplate</java-type>
      <anonymous-type-qname>http://myservice.mycompany.com/myservice:>getTemplate</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>templateId</java-variable-name>
      <xml-element-name>templateId</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <exception-mapping>
      <exception-type>com.mycompany.myservice.MyServiceFault</exception-type>
      <wsdl-message xmlns:exMsgNS="http://myservice.mycompany.com/myservice">exMsgNS:MyServiceFaultMessage</wsdl-message>
      <constructor-parameter-order>
      <element-name>errorCode</element-name>
      <element-name>errorMessage</element-name>
      </constructor-parameter-order>
      </exception-mapping>
      <service-interface-mapping>
      <service-interface>com.mycompany.myservice.MyService</service-interface>
      <wsdl-service-name xmlns:serviceNS="http://myservice.mycompany.com/myservice">serviceNS:MyService</wsdl-service-name>
      <port-mapping>
      <port-name>MyServiceEndpointPort</port-name>
      <java-port-name>MyServiceEndpointPort</java-port-name>
      </port-mapping>
      </service-interface-mapping>
      <service-endpoint-interface-mapping>
      <service-endpoint-interface>com.mycompany.myservice.MyServiceEndpoint</service-endpoint-interface>
      <wsdl-port-type xmlns:portTypeNS="http://myservice.mycompany.com/myservice">portTypeNS:MyServiceEndpoint</wsdl-port-type>
      <wsdl-binding xmlns:bindingNS="http://myservice.mycompany.com/myservice">bindingNS:MyServiceEndpointBinding</wsdl-binding>
      <service-endpoint-method-mapping>
      <java-method-name>getTemplate</java-method-name>
      <wsdl-operation>getTemplate</wsdl-operation>
      <wrapped-element/>
      <method-param-parts-mapping>
      <param-position>0</param-position>
      <param-type>int</param-type>
      <wsdl-message-mapping>
      <wsdl-message xmlns:wsdlMsgNS="http://myservice.mycompany.com/myservice">wsdlMsgNS:getTemplateRequest</wsdl-message>
      <wsdl-message-part-name>templateId</wsdl-message-part-name>
      <parameter-mode>IN</parameter-mode>
      </wsdl-message-mapping>
      </method-param-parts-mapping>
      <wsdl-return-value-mapping>
      <method-return-value>javax.activation.DataHandler</method-return-value>
      <wsdl-message xmlns:wsdlMsgNS="http://myservice.mycompany.com/myservice">wsdlMsgNS:getTemplateResponse</wsdl-message>
      <wsdl-message-part-name>template</wsdl-message-part-name>
      </wsdl-return-value-mapping>
      </service-endpoint-method-mapping>
      </service-endpoint-interface-mapping>
      </java-wsdl-mapping>


      MyServiceEndpoint.java:
      package com.mycompany.myservice;
      
      public interface MyServiceEndpoint extends java.rmi.Remote {
       public javax.activation.DataHandler getTemplate(int templateId) throws
       com.mycompany.myservice.MyServiceFault, java.rmi.RemoteException;
      }