You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Steve Mackenzie <St...@practicallaw.com> on 2010/07/07 14:14:51 UTC

Use of SOAP encoding with CXF

Hi all,

I am trying to consume a third-party (read: out of my control) service which appears to use SOAP encoding - which from my reading it seems is not well-supported by CXF.

I'd like to know - what is the current best-practice for getting around this issue, if the server cannot be changed?

I understand JAXB won't handle SOAP encoding, and while Aegis can, it isn't well-suited to generating clients from WSDLs.  Is this correct?

Just to confirm this is my problem:
   - wsdl2java gives this error for the WSDL: "WSDLToJava Error: Thrown by JAXB : undefined
     simple or complex type 'soapenc:Array'"
   - The SOAP causing the issue is as follows:

     <s:schema targetNamespace="http://tempuri.org/AbstractTypes">
      <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <s:complexType name="StringArray">
        <s:complexContent mixed="false">
          <s:restriction base="soapenc:Array">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="String" type="s:string"/>
            </s:sequence>
          </s:restriction>
        </s:complexContent>
      </s:complexType>
     </s:schema>

Cheers
Steve



Practical Law Company has been named as the 2009 InnovAction Award Winner for creating efficiency for business lawyers.


This e-mail from Practical Law Company (http://www.practicallaw.com) is subject to our terms of use (http://www.practicallaw.com/9-103-0884). Information about our companies: Practical Law Company Limited. Registered in England and Wales. Registered Number: 02889191. Registered Office: 19 Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200.
Practical Law Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.

RE: Use of SOAP encoding with CXF

Posted by Steve Mackenzie <St...@practicallaw.com>.
Thanks for the reply Glen!

I should have included my namespace declarations.  Here is the relevant one:

   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

And Array is defined in this namespace:

   <xs:element name="Array" type="tns:Array"/>
   <xs:complexType name="Array">
   [snip]
   </xs:complexType>

So what I am I missing?  Do I need to provide more of the WSDL to diagnose the problem?

Cheers
Steve

-----Original Message-----
From: Glen Mazza [mailto:glen.mazza@gmail.com]
Sent: 07 July 2010 19:09
To: users@cxf.apache.org
Subject: RE: Use of SOAP encoding with CXF



Steve Mackenzie wrote:
>
> I understand JAXB won't handle SOAP encoding, and while Aegis can, it
> isn't well-suited to generating clients from WSDLs.  Is this correct?
>
> Just to confirm this is my problem:
>    - wsdl2java gives this error for the WSDL: "WSDLToJava Error: Thrown by
> JAXB : undefined
>      simple or complex type 'soapenc:Array'"
>
>           <s:restriction base="soapenc:Array">
>

I think you're reading too much into this problem--the issue is that JAXB
simply doesn't know what soapenc:Array is because you haven't defined either
the namespace soapenc and/or the element Array.  This isn't a JAX-WS issue.

There is an issue with JAX-WS implementations like CXF or Metro not working
with RPC/encoded WSDLs, in that case you have a choice of the old JAX-RPC
from Sun, Axis 1.x, or using the JAX-WS Dispatch interface:
http://www.jroller.com/gmazza/entry/calling_rpc_encoded_web_services .  I
don't think this is your problem though.

HTH,
Glen

--
View this message in context: http://cxf.547215.n5.nabble.com/Use-of-SOAP-encoding-with-CXF-tp1044689p1044807.html
Sent from the cxf-user mailing list archive at Nabble.com.



Practical Law Company has been named as the 2009 InnovAction Award Winner for creating efficiency for business lawyers.


This e-mail from Practical Law Company (http://www.practicallaw.com) is subject to our terms of use (http://www.practicallaw.com/9-103-0884). Information about our companies: Practical Law Company Limited. Registered in England and Wales. Registered Number: 02889191. Registered Office: 19 Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200.
Practical Law Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.

RE: Use of SOAP encoding with CXF

Posted by Glen Mazza <gl...@gmail.com>.

Steve Mackenzie wrote:
> 
> I understand JAXB won't handle SOAP encoding, and while Aegis can, it
> isn't well-suited to generating clients from WSDLs.  Is this correct?
> 
> Just to confirm this is my problem:
>    - wsdl2java gives this error for the WSDL: "WSDLToJava Error: Thrown by
> JAXB : undefined
>      simple or complex type 'soapenc:Array'"
> 
>           <s:restriction base="soapenc:Array">
> 

I think you're reading too much into this problem--the issue is that JAXB
simply doesn't know what soapenc:Array is because you haven't defined either
the namespace soapenc and/or the element Array.  This isn't a JAX-WS issue.

There is an issue with JAX-WS implementations like CXF or Metro not working
with RPC/encoded WSDLs, in that case you have a choice of the old JAX-RPC
from Sun, Axis 1.x, or using the JAX-WS Dispatch interface:
http://www.jroller.com/gmazza/entry/calling_rpc_encoded_web_services .  I
don't think this is your problem though.

HTH,
Glen

-- 
View this message in context: http://cxf.547215.n5.nabble.com/Use-of-SOAP-encoding-with-CXF-tp1044689p1044807.html
Sent from the cxf-user mailing list archive at Nabble.com.

RE: Use of SOAP encoding with CXF

Posted by Steve Mackenzie <St...@practicallaw.com>.
Oops, amended below - "The *WSDL fragment* causing the issue", not "*SOAP*".

Cheers
Steve

-----Original Message-----
From: Steve Mackenzie [mailto:Steve.Mackenzie@practicallaw.com]
Sent: 07 July 2010 13:15
To: 'users@cxf.apache.org'
Subject: Use of SOAP encoding with CXF

Hi all,

I am trying to consume a third-party (read: out of my control) service which appears to use SOAP encoding - which from my reading it seems is not well-supported by CXF.

I'd like to know - what is the current best-practice for getting around this issue, if the server cannot be changed?

I understand JAXB won't handle SOAP encoding, and while Aegis can, it isn't well-suited to generating clients from WSDLs.  Is this correct?

Just to confirm this is my problem:
   - wsdl2java gives this error for the WSDL: "WSDLToJava Error: Thrown by JAXB : undefined
     simple or complex type 'soapenc:Array'"
   - The WSDL fragment causing the issue is as follows:

     <s:schema targetNamespace="http://tempuri.org/AbstractTypes">
      <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <s:complexType name="StringArray">
        <s:complexContent mixed="false">
          <s:restriction base="soapenc:Array">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="String" type="s:string"/>
            </s:sequence>
          </s:restriction>
        </s:complexContent>
      </s:complexType>
     </s:schema>

Cheers
Steve



Practical Law Company has been named as the 2009 InnovAction Award Winner for creating efficiency for business lawyers.


This e-mail from Practical Law Company (http://www.practicallaw.com) is subject to our terms of use (http://www.practicallaw.com/9-103-0884). Information about our companies: Practical Law Company Limited. Registered in England and Wales. Registered Number: 02889191. Registered Office: 19 Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200.
Practical Law Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.



Practical Law Company has been named as the 2009 InnovAction Award Winner for creating efficiency for business lawyers.


This e-mail from Practical Law Company (http://www.practicallaw.com) is subject to our terms of use (http://www.practicallaw.com/9-103-0884). Information about our companies: Practical Law Company Limited. Registered in England and Wales. Registered Number: 02889191. Registered Office: 19 Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200.
Practical Law Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.

RE: Use of SOAP encoding with CXF

Posted by Steve Mackenzie <St...@practicallaw.com>.
As it turned out there was another couple of issues with the WSDL (also .NET-related, I think) so I took a local copy and modified it to remove the <restriction> tag based on some pages I found on the web.  Thanks to Lucas Mader also for helping with this.

Cheers
Steve

-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: 09 July 2010 19:11
To: users@cxf.apache.org
Cc: Steve Mackenzie
Subject: Re: Use of SOAP encoding with CXF

On Wednesday 07 July 2010 8:14:51 am Steve Mackenzie wrote:
> Hi all,
>
> I am trying to consume a third-party (read: out of my control) service
> which appears to use SOAP encoding - which from my reading it seems is not
> well-supported by CXF.

Nor Axis2 nor Metro nor pretty much any SOAP stack that has been
created/updated in the last 5 years.   SOAP encoding is really not supported
at all anywhere anymore.


> I'd like to know - what is the current best-practice for getting around
> this issue, if the server cannot be changed?

Unfortunately, the only way to use it with modern engines is by doing much of
the "raw xml" stuff yourself.    You would use a Dispatch client with JAX-
WS/CXF  and feed it the XML payload.


Dan


>
> I understand JAXB won't handle SOAP encoding, and while Aegis can, it isn't
> well-suited to generating clients from WSDLs.  Is this correct?
>
> Just to confirm this is my problem:
>    - wsdl2java gives this error for the WSDL: "WSDLToJava Error: Thrown by
> JAXB : undefined simple or complex type 'soapenc:Array'"
>    - The SOAP causing the issue is as follows:
>
>      <s:schema targetNamespace="http://tempuri.org/AbstractTypes">
>       <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>       <s:complexType name="StringArray">
>         <s:complexContent mixed="false">
>           <s:restriction base="soapenc:Array">
>             <s:sequence>
>               <s:element minOccurs="0" maxOccurs="unbounded" name="String"
> type="s:string"/> </s:sequence>
>           </s:restriction>
>         </s:complexContent>
>       </s:complexType>
>      </s:schema>
>
> Cheers
> Steve
>
>
>
> Practical Law Company has been named as the 2009 InnovAction Award Winner
> for creating efficiency for business lawyers.
>
>
> This e-mail from Practical Law Company (http://www.practicallaw.com) is
> subject to our terms of use (http://www.practicallaw.com/9-103-0884).
> Information about our companies: Practical Law Company Limited. Registered
> in England and Wales. Registered Number: 02889191. Registered Office: 19
> Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200. Practical Law
> Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third
> Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.

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



Practical Law Company has been named as the 2009 InnovAction Award Winner for creating efficiency for business lawyers.


This e-mail from Practical Law Company (http://www.practicallaw.com) is subject to our terms of use (http://www.practicallaw.com/9-103-0884). Information about our companies: Practical Law Company Limited. Registered in England and Wales. Registered Number: 02889191. Registered Office: 19 Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200.
Practical Law Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.

Re: Use of SOAP encoding with CXF

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 07 July 2010 8:14:51 am Steve Mackenzie wrote:
> Hi all,
> 
> I am trying to consume a third-party (read: out of my control) service
> which appears to use SOAP encoding - which from my reading it seems is not
> well-supported by CXF.

Nor Axis2 nor Metro nor pretty much any SOAP stack that has been 
created/updated in the last 5 years.   SOAP encoding is really not supported 
at all anywhere anymore.


> I'd like to know - what is the current best-practice for getting around
> this issue, if the server cannot be changed?

Unfortunately, the only way to use it with modern engines is by doing much of 
the "raw xml" stuff yourself.    You would use a Dispatch client with JAX-
WS/CXF  and feed it the XML payload.    


Dan


> 
> I understand JAXB won't handle SOAP encoding, and while Aegis can, it isn't
> well-suited to generating clients from WSDLs.  Is this correct?
> 
> Just to confirm this is my problem:
>    - wsdl2java gives this error for the WSDL: "WSDLToJava Error: Thrown by
> JAXB : undefined simple or complex type 'soapenc:Array'"
>    - The SOAP causing the issue is as follows:
> 
>      <s:schema targetNamespace="http://tempuri.org/AbstractTypes">
>       <s:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>       <s:complexType name="StringArray">
>         <s:complexContent mixed="false">
>           <s:restriction base="soapenc:Array">
>             <s:sequence>
>               <s:element minOccurs="0" maxOccurs="unbounded" name="String"
> type="s:string"/> </s:sequence>
>           </s:restriction>
>         </s:complexContent>
>       </s:complexType>
>      </s:schema>
> 
> Cheers
> Steve
> 
> 
> 
> Practical Law Company has been named as the 2009 InnovAction Award Winner
> for creating efficiency for business lawyers.
> 
> 
> This e-mail from Practical Law Company (http://www.practicallaw.com) is
> subject to our terms of use (http://www.practicallaw.com/9-103-0884).
> Information about our companies: Practical Law Company Limited. Registered
> in England and Wales. Registered Number: 02889191. Registered Office: 19
> Hatfields, London SE1 8DJ. Telephone: +44(0)20 7202 1200. Practical Law
> Company, Inc. Incorporated in Delaware, USA.  Corporate Office: 747 Third
> Avenue, 36th Floor, New York, NY 10017. Telephone: +1(646) 562-3400.

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