You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cortlander <ar...@diamelle.com> on 2008/06/20 02:28:36 UTC

How to make SOAPBinding.ParameterStyle.WRAPPED instead of BARE?

I am using CXF’s WDSL to Java utility to generate code from a wsdl.  I would
like to map my wsdl operations to SOAPBinding.ParameterStyle.WRAPPED  so
that  methods with void return types do not return objects like xxxResponse: 
/**
 * This class was generated by Apache CXF 2.1
 * Thu Jun 19 15:09:17 EDT 2008
 * Generated source version: 2.1
 * 
 */

@WebService(targetNamespace = "urn:idm.openiam.org/ws/org", name =
"organizationData")
@XmlSeeAlso({org.openiam.idm.types.metadata.ObjectFactory.class,org.openiam.idm.types.organization.ObjectFactory.class,ObjectFactory.class})

public interface OrganizationData {

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(name = "removeAttributeResponse", targetNamespace =
"urn:idm.openiam.org/ws/org", partName = "removeAttributeResponse")
    @WebMethod
    public RemoveAttributeResponse removeAttribute(
        @WebParam(partName = "removeAttribute", name = "removeAttribute",
targetNamespace = "urn:idm.openiam.org/ws/org")
        org.openiam.idm.types.organization.OrganizationAttribute
removeAttribute
    );

    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @WebResult(name = "addAttributeResponse", targetNamespace =
"urn:idm.openiam.org/ws/org", partName = "addAttributeResponse")
    @WebMethod
    public AddAttributeResponse addAttribute(
        @WebParam(partName = "addAttribute", name = "addAttribute",
targetNamespace = "urn:idm.openiam.org/ws/org")
        org.openiam.idm.types.organization.OrganizationAttribute
addAttribute
    );

Etc..


Excerpts from the WSDL includes the following:


<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions name="OrganizationData"
targetNamespace="urn:idm.openiam.org/ws/org"
	xmlns:tns="urn:idm.openiam.org/ws/org"
xmlns:ns1="urn:idm.openiam.org/ws/org"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:org="urn:idm.openiam.org/types/organization"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

	<!-- Types ******************************************************** -->

	<wsdl:types>
		<xsd:schema targetNamespace="urn:idm.openiam.org/ws/org"
			xmlns:tns="urn:idm.openiam.org/ws/org"
xmlns="http://www.w3.org/2001/XMLSchema"
			attributeFormDefault="qualified" elementFormDefault="unqualified">

			<xsd:import namespace="urn:idm.openiam.org/types/organization"
				schemaLocation="organization.xsd" />

...
			<xsd:element name="removeAttribute" nillable="true"
type="org:organizationAttribute" />

			<xsd:element name="removeAttributeResponse">
				<xsd:complexType>
					<xsd:sequence />
				</xsd:complexType>
			</xsd:element>


			<xsd:element name="addAttribute" nillable="true"
type="org:organizationAttribute" />

			<xsd:element name="addAttributeResponse">
				<xsd:complexType>
					<xsd:sequence />
				</xsd:complexType>
			</xsd:element>

 . . .
		</xsd:schema>
	</wsdl:types>

<!-- Messages ******************************************************** -->

. . .

	<wsdl:message name="addAttribute">
		<wsdl:part name="addAttribute" element="ns1:addAttribute"></wsdl:part>
	</wsdl:message>
	<wsdl:message name="addAttributeResponse">
		<wsdl:part name="addAttributeResponse"
element="ns1:addAttributeResponse"></wsdl:part>
	</wsdl:message>

	<wsdl:message name="removeAttribute">
		<wsdl:part name="removeAttribute"
element="ns1:removeAttribute"></wsdl:part>
	</wsdl:message>
	<wsdl:message name="removeAttributeResponse">
		<wsdl:part name="removeAttributeResponse"
element="ns1:removeAttributeResponse"></wsdl:part>
	</wsdl:message>

. . .

<!-- portType ******************************************************** -->

<wsdl:portType name="organizationData">

		<wsdl:operation name="removeAttribute">
			<wsdl:input name="removeAttribute"
message="tns:removeAttribute"></wsdl:input>
			<wsdl:output name="removeAttributeResponse"
message="tns:removeAttributeResponse">
			</wsdl:output>
		</wsdl:operation>

		<wsdl:operation name="addAttribute">
			<wsdl:input name="addAttribute" message="tns:addAttribute"></wsdl:input>
			<wsdl:output name="addAttributeResponse"
message="tns:addAttributeResponse">
			</wsdl:output>
		</wsdl:operation>


. . .

</wsdl:portType>

<!-- Binding ******************************************************** -->

	<wsdl:binding name="OrganizationDataBinding" type="tns:organizationData">
		<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />


		<wsdl:operation name="addAttribute">
			<soap:operation soapAction="" style="document" />
			<wsdl:input name="addAttribute">
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output name="addAttributeResponse">
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>


		<wsdl:operation name="removeAttribute">
			<soap:operation soapAction="" style="document" />
			<wsdl:input name="removeAttribute">
				<soap:body use="literal" />
			</wsdl:input>
			<wsdl:output name="removeAttributeResponse">
				<soap:body use="literal" />
			</wsdl:output>
		</wsdl:operation>
. . .

	</wsdl:binding>

<!-- Service ******************************************************** -->

	<wsdl:service name="OrganizationDataService">
		<wsdl:port name="OrganizationDataPort"
binding="tns:OrganizationDataBinding">
			<soap:address location="http://localhost:9090/OrganizationDataPort" />
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>                                

I saw another post which mentioned the part element name must be the same as
the operation name, but it seems that I am doing that here. I have also
tried the following suggestion, but that did not help either.

	<wsdl:portType name="organizationData">
    	<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
        	<enableWrapperStyle>true</enableWrapperStyle>
    	</jaxws:bindings>


Any help to point me in the right direction would be much appreciated. 

Thank you,

cortlander

-- 
View this message in context: http://www.nabble.com/How-to-make-SOAPBinding.ParameterStyle.WRAPPED-instead-of-BARE--tp18020764p18020764.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to make SOAPBinding.ParameterStyle.WRAPPED instead of BARE?

Posted by cortlander <ar...@diamelle.com>.
Willem, I am doing WSDL to Java i.e. I am starting from a WSDL to generate
Java class. The class generation is done by the wsdlToJava utility so I am
unable to move @SOAPBinding.

cortlander




How about moving the @SOAPBinding  to the top of  Class ?
Here is the example[1] in the CXF systest.

[1]https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java

Willem


cortlander wrote:
> I am using CXF’s WDSL to Java utility to generate code from a wsdl.  I
> would
> like to map my wsdl operations to SOAPBinding.ParameterStyle.WRAPPED  so
> that  methods with void return types do not return objects like
> xxxResponse: 
> /**

-- 
View this message in context: http://www.nabble.com/How-to-make-SOAPBinding.ParameterStyle.WRAPPED-instead-of-BARE--tp18020764p18026567.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to make SOAPBinding.ParameterStyle.WRAPPED instead of BARE?

Posted by Willem Jiang <wi...@gmail.com>.
How about moving the @SOAPBinding  to the top of  Class ?
Here is the example[1] in the CXF systest.

[1]https://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/DocLitBareCodeFirstService.java

Willem


cortlander wrote:
> I am using CXF’s WDSL to Java utility to generate code from a wsdl.  I would
> like to map my wsdl operations to SOAPBinding.ParameterStyle.WRAPPED  so
> that  methods with void return types do not return objects like xxxResponse: 
> /**
>  * This class was generated by Apache CXF 2.1
>  * Thu Jun 19 15:09:17 EDT 2008
>  * Generated source version: 2.1
>  * 
>  */
>
> @WebService(targetNamespace = "urn:idm.openiam.org/ws/org", name =
> "organizationData")
> @XmlSeeAlso({org.openiam.idm.types.metadata.ObjectFactory.class,org.openiam.idm.types.organization.ObjectFactory.class,ObjectFactory.class})
>
> public interface OrganizationData {
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(name = "removeAttributeResponse", targetNamespace =
> "urn:idm.openiam.org/ws/org", partName = "removeAttributeResponse")
>     @WebMethod
>     public RemoveAttributeResponse removeAttribute(
>         @WebParam(partName = "removeAttribute", name = "removeAttribute",
> targetNamespace = "urn:idm.openiam.org/ws/org")
>         org.openiam.idm.types.organization.OrganizationAttribute
> removeAttribute
>     );
>
>     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>     @WebResult(name = "addAttributeResponse", targetNamespace =
> "urn:idm.openiam.org/ws/org", partName = "addAttributeResponse")
>     @WebMethod
>     public AddAttributeResponse addAttribute(
>         @WebParam(partName = "addAttribute", name = "addAttribute",
> targetNamespace = "urn:idm.openiam.org/ws/org")
>         org.openiam.idm.types.organization.OrganizationAttribute
> addAttribute
>     );
>
> Etc..
>
>
> Excerpts from the WSDL includes the following:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions name="OrganizationData"
> targetNamespace="urn:idm.openiam.org/ws/org"
> 	xmlns:tns="urn:idm.openiam.org/ws/org"
> xmlns:ns1="urn:idm.openiam.org/ws/org"
> 	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:org="urn:idm.openiam.org/types/organization"
> 	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
>
> 	<!-- Types ******************************************************** -->
>
> 	<wsdl:types>
> 		<xsd:schema targetNamespace="urn:idm.openiam.org/ws/org"
> 			xmlns:tns="urn:idm.openiam.org/ws/org"
> xmlns="http://www.w3.org/2001/XMLSchema"
> 			attributeFormDefault="qualified" elementFormDefault="unqualified">
>
> 			<xsd:import namespace="urn:idm.openiam.org/types/organization"
> 				schemaLocation="organization.xsd" />
>
> ...
> 			<xsd:element name="removeAttribute" nillable="true"
> type="org:organizationAttribute" />
>
> 			<xsd:element name="removeAttributeResponse">
> 				<xsd:complexType>
> 					<xsd:sequence />
> 				</xsd:complexType>
> 			</xsd:element>
>
>
> 			<xsd:element name="addAttribute" nillable="true"
> type="org:organizationAttribute" />
>
> 			<xsd:element name="addAttributeResponse">
> 				<xsd:complexType>
> 					<xsd:sequence />
> 				</xsd:complexType>
> 			</xsd:element>
>
>  . . .
> 		</xsd:schema>
> 	</wsdl:types>
>
> <!-- Messages ******************************************************** -->
>
> . . .
>
> 	<wsdl:message name="addAttribute">
> 		<wsdl:part name="addAttribute" element="ns1:addAttribute"></wsdl:part>
> 	</wsdl:message>
> 	<wsdl:message name="addAttributeResponse">
> 		<wsdl:part name="addAttributeResponse"
> element="ns1:addAttributeResponse"></wsdl:part>
> 	</wsdl:message>
>
> 	<wsdl:message name="removeAttribute">
> 		<wsdl:part name="removeAttribute"
> element="ns1:removeAttribute"></wsdl:part>
> 	</wsdl:message>
> 	<wsdl:message name="removeAttributeResponse">
> 		<wsdl:part name="removeAttributeResponse"
> element="ns1:removeAttributeResponse"></wsdl:part>
> 	</wsdl:message>
>
> . . .
>
> <!-- portType ******************************************************** -->
>
> <wsdl:portType name="organizationData">
>
> 		<wsdl:operation name="removeAttribute">
> 			<wsdl:input name="removeAttribute"
> message="tns:removeAttribute"></wsdl:input>
> 			<wsdl:output name="removeAttributeResponse"
> message="tns:removeAttributeResponse">
> 			</wsdl:output>
> 		</wsdl:operation>
>
> 		<wsdl:operation name="addAttribute">
> 			<wsdl:input name="addAttribute" message="tns:addAttribute"></wsdl:input>
> 			<wsdl:output name="addAttributeResponse"
> message="tns:addAttributeResponse">
> 			</wsdl:output>
> 		</wsdl:operation>
>
>
> . . .
>
> </wsdl:portType>
>
> <!-- Binding ******************************************************** -->
>
> 	<wsdl:binding name="OrganizationDataBinding" type="tns:organizationData">
> 		<soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
>
>
> 		<wsdl:operation name="addAttribute">
> 			<soap:operation soapAction="" style="document" />
> 			<wsdl:input name="addAttribute">
> 				<soap:body use="literal" />
> 			</wsdl:input>
> 			<wsdl:output name="addAttributeResponse">
> 				<soap:body use="literal" />
> 			</wsdl:output>
> 		</wsdl:operation>
>
>
> 		<wsdl:operation name="removeAttribute">
> 			<soap:operation soapAction="" style="document" />
> 			<wsdl:input name="removeAttribute">
> 				<soap:body use="literal" />
> 			</wsdl:input>
> 			<wsdl:output name="removeAttributeResponse">
> 				<soap:body use="literal" />
> 			</wsdl:output>
> 		</wsdl:operation>
> . . .
>
> 	</wsdl:binding>
>
> <!-- Service ******************************************************** -->
>
> 	<wsdl:service name="OrganizationDataService">
> 		<wsdl:port name="OrganizationDataPort"
> binding="tns:OrganizationDataBinding">
> 			<soap:address location="http://localhost:9090/OrganizationDataPort" />
> 		</wsdl:port>
> 	</wsdl:service>
> </wsdl:definitions>                                
>
> I saw another post which mentioned the part element name must be the same as
> the operation name, but it seems that I am doing that here. I have also
> tried the following suggestion, but that did not help either.
>
> 	<wsdl:portType name="organizationData">
>     	<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
>         	<enableWrapperStyle>true</enableWrapperStyle>
>     	</jaxws:bindings>
>
>
> Any help to point me in the right direction would be much appreciated. 
>
> Thank you,
>
> cortlander
>
>   


Re: How to make SOAPBinding.ParameterStyle.WRAPPED instead of BARE?

Posted by cortlander <ar...@diamelle.com>.
Dan, your solution did fix the above operations.
I will go through the rules and apply them to the rest of the wsdl.

cortlander 


dkulp wrote:
> 
> 
> Your wsdl/schema must follow the JAX-WS rules for what constitutes  
> unwrappable schemas as per JAX-WS spec section 2.3.1.2.   Yours does  
> not meet the rules.   Specifically, the last rule:
> 
> "The wrapper elements only contain child elements, they MUST not  
> contain other structures such
> as wildcards (element or attribute), xsd:choice, substitution groups  
> (element references are not
> permitted) or attributes; furthermore, they MUST not be nillable"
> 
> 
> Your top level elements for the requests are nillable.   Thus, the  
> operation is not unwrappable.
> 
> Dan
> 
> 
> 
> On Jun 19, 2008, at 8:28 PM, cortlander wrote:
> 
>>
>> I am using CXF’s WDSL to Java utility to generate code from a wsdl.   
>> I would
>> like to map my wsdl operations to  
>> SOAPBinding.ParameterStyle.WRAPPED  so
>> that  methods with void return types do not return objects like  
>> xxxResponse:
>> /**
>> * This class was generated by Apache CXF 2.1
>> * Thu Jun 19 15:09:17 EDT 2008
>> * Generated source version: 2.1
>> *
>> */
>>
>> @WebService(targetNamespace = "urn:idm.openiam.org/ws/org", name =
>> "organizationData")
>> @XmlSeeAlso 
>> ({org 
>> .openiam 
>> .idm 
>> .types 
>> .metadata 
>> .ObjectFactory 
>> .class 
>> ,org 
>> .openiam 
>> .idm.types.organization.ObjectFactory.class,ObjectFactory.class})
>>
>> public interface OrganizationData {
>>
>>    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>>    @WebResult(name = "removeAttributeResponse", targetNamespace =
>> "urn:idm.openiam.org/ws/org", partName = "removeAttributeResponse")
>>    @WebMethod
>>    public RemoveAttributeResponse removeAttribute(
>>        @WebParam(partName = "removeAttribute", name =  
>> "removeAttribute",
>> targetNamespace = "urn:idm.openiam.org/ws/org")
>>        org.openiam.idm.types.organization.OrganizationAttribute
>> removeAttribute
>>    );
>>
>>    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>>    @WebResult(name = "addAttributeResponse", targetNamespace =
>> "urn:idm.openiam.org/ws/org", partName = "addAttributeResponse")
>>    @WebMethod
>>    public AddAttributeResponse addAttribute(
>>        @WebParam(partName = "addAttribute", name = "addAttribute",
>> targetNamespace = "urn:idm.openiam.org/ws/org")
>>        org.openiam.idm.types.organization.OrganizationAttribute
>> addAttribute
>>    );
>>
>> Etc..
>>
>>
>> Excerpts from the WSDL includes the following:
>>
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <wsdl:definitions name="OrganizationData"
>> targetNamespace="urn:idm.openiam.org/ws/org"
>> 	xmlns:tns="urn:idm.openiam.org/ws/org"
>> xmlns:ns1="urn:idm.openiam.org/ws/org"
>> 	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>> xmlns:org="urn:idm.openiam.org/types/organization"
>> 	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
>>
>> 	<!-- Types ********************************************************  
>> -->
>>
>> 	<wsdl:types>
>> 		<xsd:schema targetNamespace="urn:idm.openiam.org/ws/org"
>> 			xmlns:tns="urn:idm.openiam.org/ws/org"
>> xmlns="http://www.w3.org/2001/XMLSchema"
>> 			attributeFormDefault="qualified" elementFormDefault="unqualified">
>>
>> 			<xsd:import namespace="urn:idm.openiam.org/types/organization"
>> 				schemaLocation="organization.xsd" />
>>
>> ...
>> 			<xsd:element name="removeAttribute" nillable="true"
>> type="org:organizationAttribute" />
>>
>> 			<xsd:element name="removeAttributeResponse">
>> 				<xsd:complexType>
>> 					<xsd:sequence />
>> 				</xsd:complexType>
>> 			</xsd:element>
>>
>>
>> 			<xsd:element name="addAttribute" nillable="true"
>> type="org:organizationAttribute" />
>>
>> 			<xsd:element name="addAttributeResponse">
>> 				<xsd:complexType>
>> 					<xsd:sequence />
>> 				</xsd:complexType>
>> 			</xsd:element>
>>
>> . . .
>> 		</xsd:schema>
>> 	</wsdl:types>
>>
>> <!-- Messages  
>> ******************************************************** -->
>>
>> . . .
>>
>> 	<wsdl:message name="addAttribute">
>> 		<wsdl:part name="addAttribute" element="ns1:addAttribute"></ 
>> wsdl:part>
>> 	</wsdl:message>
>> 	<wsdl:message name="addAttributeResponse">
>> 		<wsdl:part name="addAttributeResponse"
>> element="ns1:addAttributeResponse"></wsdl:part>
>> 	</wsdl:message>
>>
>> 	<wsdl:message name="removeAttribute">
>> 		<wsdl:part name="removeAttribute"
>> element="ns1:removeAttribute"></wsdl:part>
>> 	</wsdl:message>
>> 	<wsdl:message name="removeAttributeResponse">
>> 		<wsdl:part name="removeAttributeResponse"
>> element="ns1:removeAttributeResponse"></wsdl:part>
>> 	</wsdl:message>
>>
>> . . .
>>
>> <!-- portType  
>> ******************************************************** -->
>>
>> <wsdl:portType name="organizationData">
>>
>> 		<wsdl:operation name="removeAttribute">
>> 			<wsdl:input name="removeAttribute"
>> message="tns:removeAttribute"></wsdl:input>
>> 			<wsdl:output name="removeAttributeResponse"
>> message="tns:removeAttributeResponse">
>> 			</wsdl:output>
>> 		</wsdl:operation>
>>
>> 		<wsdl:operation name="addAttribute">
>> 			<wsdl:input name="addAttribute" message="tns:addAttribute"></ 
>> wsdl:input>
>> 			<wsdl:output name="addAttributeResponse"
>> message="tns:addAttributeResponse">
>> 			</wsdl:output>
>> 		</wsdl:operation>
>>
>>
>> . . .
>>
>> </wsdl:portType>
>>
>> <!-- Binding  
>> ******************************************************** -->
>>
>> 	<wsdl:binding name="OrganizationDataBinding"  
>> type="tns:organizationData">
>> 		<soap:binding style="document"
>> transport="http://schemas.xmlsoap.org/soap/http" />
>>
>>
>> 		<wsdl:operation name="addAttribute">
>> 			<soap:operation soapAction="" style="document" />
>> 			<wsdl:input name="addAttribute">
>> 				<soap:body use="literal" />
>> 			</wsdl:input>
>> 			<wsdl:output name="addAttributeResponse">
>> 				<soap:body use="literal" />
>> 			</wsdl:output>
>> 		</wsdl:operation>
>>
>>
>> 		<wsdl:operation name="removeAttribute">
>> 			<soap:operation soapAction="" style="document" />
>> 			<wsdl:input name="removeAttribute">
>> 				<soap:body use="literal" />
>> 			</wsdl:input>
>> 			<wsdl:output name="removeAttributeResponse">
>> 				<soap:body use="literal" />
>> 			</wsdl:output>
>> 		</wsdl:operation>
>> . . .
>>
>> 	</wsdl:binding>
>>
>> <!-- Service  
>> ******************************************************** -->
>>
>> 	<wsdl:service name="OrganizationDataService">
>> 		<wsdl:port name="OrganizationDataPort"
>> binding="tns:OrganizationDataBinding">
>> 			<soap:address location="http://localhost:9090/ 
>> OrganizationDataPort" />
>> 		</wsdl:port>
>> 	</wsdl:service>
>> </wsdl:definitions>
>>
>> I saw another post which mentioned the part element name must be the  
>> same as
>> the operation name, but it seems that I am doing that here. I have  
>> also
>> tried the following suggestion, but that did not help either.
>>
>> 	<wsdl:portType name="organizationData">
>>    	<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
>>        	<enableWrapperStyle>true</enableWrapperStyle>
>>    	</jaxws:bindings>
>>
>>
>> Any help to point me in the right direction would be much appreciated.
>>
>> Thank you,
>>
>> cortlander
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-to-make-SOAPBinding.ParameterStyle.WRAPPED-instead-of-BARE--tp18020764p18020764.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
> 
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-make-SOAPBinding.ParameterStyle.WRAPPED-instead-of-BARE--tp18020764p18034760.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to make SOAPBinding.ParameterStyle.WRAPPED instead of BARE?

Posted by Daniel Kulp <dk...@apache.org>.
Your wsdl/schema must follow the JAX-WS rules for what constitutes  
unwrappable schemas as per JAX-WS spec section 2.3.1.2.   Yours does  
not meet the rules.   Specifically, the last rule:

"The wrapper elements only contain child elements, they MUST not  
contain other structures such
as wildcards (element or attribute), xsd:choice, substitution groups  
(element references are not
permitted) or attributes; furthermore, they MUST not be nillable"


Your top level elements for the requests are nillable.   Thus, the  
operation is not unwrappable.

Dan



On Jun 19, 2008, at 8:28 PM, cortlander wrote:

>
> I am using CXF’s WDSL to Java utility to generate code from a wsdl.   
> I would
> like to map my wsdl operations to  
> SOAPBinding.ParameterStyle.WRAPPED  so
> that  methods with void return types do not return objects like  
> xxxResponse:
> /**
> * This class was generated by Apache CXF 2.1
> * Thu Jun 19 15:09:17 EDT 2008
> * Generated source version: 2.1
> *
> */
>
> @WebService(targetNamespace = "urn:idm.openiam.org/ws/org", name =
> "organizationData")
> @XmlSeeAlso 
> ({org 
> .openiam 
> .idm 
> .types 
> .metadata 
> .ObjectFactory 
> .class 
> ,org 
> .openiam 
> .idm.types.organization.ObjectFactory.class,ObjectFactory.class})
>
> public interface OrganizationData {
>
>    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>    @WebResult(name = "removeAttributeResponse", targetNamespace =
> "urn:idm.openiam.org/ws/org", partName = "removeAttributeResponse")
>    @WebMethod
>    public RemoveAttributeResponse removeAttribute(
>        @WebParam(partName = "removeAttribute", name =  
> "removeAttribute",
> targetNamespace = "urn:idm.openiam.org/ws/org")
>        org.openiam.idm.types.organization.OrganizationAttribute
> removeAttribute
>    );
>
>    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>    @WebResult(name = "addAttributeResponse", targetNamespace =
> "urn:idm.openiam.org/ws/org", partName = "addAttributeResponse")
>    @WebMethod
>    public AddAttributeResponse addAttribute(
>        @WebParam(partName = "addAttribute", name = "addAttribute",
> targetNamespace = "urn:idm.openiam.org/ws/org")
>        org.openiam.idm.types.organization.OrganizationAttribute
> addAttribute
>    );
>
> Etc..
>
>
> Excerpts from the WSDL includes the following:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions name="OrganizationData"
> targetNamespace="urn:idm.openiam.org/ws/org"
> 	xmlns:tns="urn:idm.openiam.org/ws/org"
> xmlns:ns1="urn:idm.openiam.org/ws/org"
> 	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:org="urn:idm.openiam.org/types/organization"
> 	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
>
> 	<!-- Types ********************************************************  
> -->
>
> 	<wsdl:types>
> 		<xsd:schema targetNamespace="urn:idm.openiam.org/ws/org"
> 			xmlns:tns="urn:idm.openiam.org/ws/org"
> xmlns="http://www.w3.org/2001/XMLSchema"
> 			attributeFormDefault="qualified" elementFormDefault="unqualified">
>
> 			<xsd:import namespace="urn:idm.openiam.org/types/organization"
> 				schemaLocation="organization.xsd" />
>
> ...
> 			<xsd:element name="removeAttribute" nillable="true"
> type="org:organizationAttribute" />
>
> 			<xsd:element name="removeAttributeResponse">
> 				<xsd:complexType>
> 					<xsd:sequence />
> 				</xsd:complexType>
> 			</xsd:element>
>
>
> 			<xsd:element name="addAttribute" nillable="true"
> type="org:organizationAttribute" />
>
> 			<xsd:element name="addAttributeResponse">
> 				<xsd:complexType>
> 					<xsd:sequence />
> 				</xsd:complexType>
> 			</xsd:element>
>
> . . .
> 		</xsd:schema>
> 	</wsdl:types>
>
> <!-- Messages  
> ******************************************************** -->
>
> . . .
>
> 	<wsdl:message name="addAttribute">
> 		<wsdl:part name="addAttribute" element="ns1:addAttribute"></ 
> wsdl:part>
> 	</wsdl:message>
> 	<wsdl:message name="addAttributeResponse">
> 		<wsdl:part name="addAttributeResponse"
> element="ns1:addAttributeResponse"></wsdl:part>
> 	</wsdl:message>
>
> 	<wsdl:message name="removeAttribute">
> 		<wsdl:part name="removeAttribute"
> element="ns1:removeAttribute"></wsdl:part>
> 	</wsdl:message>
> 	<wsdl:message name="removeAttributeResponse">
> 		<wsdl:part name="removeAttributeResponse"
> element="ns1:removeAttributeResponse"></wsdl:part>
> 	</wsdl:message>
>
> . . .
>
> <!-- portType  
> ******************************************************** -->
>
> <wsdl:portType name="organizationData">
>
> 		<wsdl:operation name="removeAttribute">
> 			<wsdl:input name="removeAttribute"
> message="tns:removeAttribute"></wsdl:input>
> 			<wsdl:output name="removeAttributeResponse"
> message="tns:removeAttributeResponse">
> 			</wsdl:output>
> 		</wsdl:operation>
>
> 		<wsdl:operation name="addAttribute">
> 			<wsdl:input name="addAttribute" message="tns:addAttribute"></ 
> wsdl:input>
> 			<wsdl:output name="addAttributeResponse"
> message="tns:addAttributeResponse">
> 			</wsdl:output>
> 		</wsdl:operation>
>
>
> . . .
>
> </wsdl:portType>
>
> <!-- Binding  
> ******************************************************** -->
>
> 	<wsdl:binding name="OrganizationDataBinding"  
> type="tns:organizationData">
> 		<soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
>
>
> 		<wsdl:operation name="addAttribute">
> 			<soap:operation soapAction="" style="document" />
> 			<wsdl:input name="addAttribute">
> 				<soap:body use="literal" />
> 			</wsdl:input>
> 			<wsdl:output name="addAttributeResponse">
> 				<soap:body use="literal" />
> 			</wsdl:output>
> 		</wsdl:operation>
>
>
> 		<wsdl:operation name="removeAttribute">
> 			<soap:operation soapAction="" style="document" />
> 			<wsdl:input name="removeAttribute">
> 				<soap:body use="literal" />
> 			</wsdl:input>
> 			<wsdl:output name="removeAttributeResponse">
> 				<soap:body use="literal" />
> 			</wsdl:output>
> 		</wsdl:operation>
> . . .
>
> 	</wsdl:binding>
>
> <!-- Service  
> ******************************************************** -->
>
> 	<wsdl:service name="OrganizationDataService">
> 		<wsdl:port name="OrganizationDataPort"
> binding="tns:OrganizationDataBinding">
> 			<soap:address location="http://localhost:9090/ 
> OrganizationDataPort" />
> 		</wsdl:port>
> 	</wsdl:service>
> </wsdl:definitions>
>
> I saw another post which mentioned the part element name must be the  
> same as
> the operation name, but it seems that I am doing that here. I have  
> also
> tried the following suggestion, but that did not help either.
>
> 	<wsdl:portType name="organizationData">
>    	<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
>        	<enableWrapperStyle>true</enableWrapperStyle>
>    	</jaxws:bindings>
>
>
> Any help to point me in the right direction would be much appreciated.
>
> Thank you,
>
> cortlander
>
> -- 
> View this message in context: http://www.nabble.com/How-to-make-SOAPBinding.ParameterStyle.WRAPPED-instead-of-BARE--tp18020764p18020764.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog