[ 
http://jira.codehaus.org/browse/XFIRE-1105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_113940
 ] 

Benoit Guillon commented on XFIRE-1105:
---------------------------------------

For information, if someone faces the same issue, it can be resolved by 
modifing the targetNamespace attribute value like below:

@WebService(name="MyService", targetNamespace="http://mycompany.com/myService";)
@SOAPBinding(style=Style.DOCUMENT,
use=Use.LITERAL,
parameterStyle=ParameterStyle.WRAPPED)

public class MyService
{
@WebResult(name="ReturnStructure", 
targetNamespace="http://mycompany.com/myService";)
public ReturnStructure doSomething(@WebParam(name = "parameter")int parameter)
{ 
ReturnStructure result = new ReturnStructure(); result.setCode("CODE"); 
result.setSubcode("SUBCODE"); result.setMessage("MESSAGE"); return result; }

}

> WebResult annotation: targetNamespace problem
> ---------------------------------------------
>
>                 Key: XFIRE-1105
>                 URL: http://jira.codehaus.org/browse/XFIRE-1105
>             Project: XFire
>          Issue Type: Bug
>          Components: JAX-WS
>    Affects Versions: 1.2.6
>            Reporter: Benoit Guillon
>            Assignee: Dan Diephouse
>
> I found a problem with the targetNamespace attribute of the JAXWS WebResult 
> annotation:
> Here is a simple service:
> -----
> package com.mycompany.services;
> import javax.jws.WebParam;
> import javax.jws.WebResult;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.soap.SOAPBinding.ParameterStyle;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding.Use;
> import com.mycompany.beans.ReturnStructure;
> @WebService(name="MyService", 
> targetNamespace="http://mycompany.com/myService";)
> @SOAPBinding(style=Style.DOCUMENT, 
>         use=Use.LITERAL, 
>         parameterStyle=ParameterStyle.WRAPPED)
> public class MyService
> {
>     @WebResult(name="ReturnStructure", 
> targetNamespace="http://mycompany.com/beans";)
>     public ReturnStructure doSomething(@WebParam(name = "parameter")int 
> parameter)
>     {
>         ReturnStructure result = new ReturnStructure();
>         result.setCode("CODE");
>         result.setSubcode("SUBCODE");
>         result.setMessage("MESSAGE");
>         return result;
>     }
> }
> -----
> The ReturnStructure class is generated from the XSD below using JAXB2:
> <?xml version="1.0" encoding="UTF-8"?>
> <schema targetNamespace="http://mycompany.com/beans"; 
> elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema"; 
> xmlns:tns="http://mycompany.com/beans";>
>     <complexType name="ReturnStructure">
>       <sequence>
>               <element name="code" type="string"></element>
>               <element name="subcode" type="string"></element>
>               <element name="message" type="string"></element>
>       </sequence>
>     </complexType>
> </schema>
> -----
> When the service is deployed using XFire, the published WSDL is:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://mycompany.com/myService"; 
> xmlns:tns="http://mycompany.com/myService"; 
> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
> xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"; 
> xmlns:ns1="http://mycompany.com/beans"; 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"; 
> xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"; 
> xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
>   <wsdl:types>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"; 
> xmlns:tns="http://mycompany.com/beans"; elementFormDefault="qualified" 
> targetNamespace="http://mycompany.com/beans";>
>     <complexType name="ReturnStructure">
>       <sequence>
>               <element name="code" type="string"/>
>               <element name="subcode" type="string"/>
>               <element name="message" type="string"/>
>       </sequence>
>     </complexType>
> </schema>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> attributeFormDefault="qualified" elementFormDefault="qualified" 
> targetNamespace="http://mycompany.com/myService";>
> <xsd:element name="doSomething">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="parameter" type="xsd:int"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> <xsd:element name="doSomethingResponse">
> <xsd:complexType>
> <xsd:sequence>
> <xsd:element maxOccurs="1" minOccurs="1" name="ReturnStructure" 
> nillable="true" type="ns1:ReturnStructure"/>
> </xsd:sequence>
> </xsd:complexType>
> </xsd:element>
> </xsd:schema>
>   </wsdl:types>
>   <wsdl:message name="doSomethingResponse">
>     <wsdl:part name="parameters" element="tns:doSomethingResponse">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="doSomethingRequest">
>     <wsdl:part name="parameters" element="tns:doSomething">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:portType name="MyService">
>     <wsdl:operation name="doSomething">
>       <wsdl:input name="doSomethingRequest" message="tns:doSomethingRequest">
>     </wsdl:input>
>       <wsdl:output name="doSomethingResponse" 
> message="tns:doSomethingResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="MyServiceHttpBinding" type="tns:MyService">
>     <wsdlsoap:binding style="document" 
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="doSomething">
>       <wsdlsoap:operation soapAction=""/>
>       <wsdl:input name="doSomethingRequest">
>         <wsdlsoap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="doSomethingResponse">
>         <wsdlsoap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="MyService">
>     <wsdl:port name="MyServiceHttpPort" binding="tns:MyServiceHttpBinding">
>       <wsdlsoap:address 
> location="http://localhost:8082/reprod/services/MyService"/>
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
> ----
> The problem is that the "doSomethingResponse" element  contains a 
> ReturnStructure element declared in the service namespace instead of the bean 
> namespace as specified by the targetNamespace attribute of the WebResult 
> annotation.
> Thus, when the service is invoked, the response does not comply with the WSDL 
> but with the WebResult annotation:
> ----
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>    <soap:Body>
>       <ns1:doSomethingResponse xmlns:ns1="http://mycompany.com/myService";>
>          <ReturnStructure xmlns="http://mycompany.com/beans";>
>             <code>CODE</code>
>             <subcode>SUBCODE</subcode>
>             <message>MESSAGE</message>
>          </ReturnStructure>
>       </ns1:doSomethingResponse>
>    </soap:Body>
> </soap:Envelope>
> ----
> This response is not valid regarding the WSDL ! The ReturnStructure should be 
> ns1:ReturnStructure !
> For information, the call do not fail using an XFire client (generated one or 
> Spring remoting one) but it fails with any other client (I actually tried 
> with Axis2).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to