You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "Poindexter, Miles" <Mi...@condenast.com> on 2012/10/17 16:43:43 UTC

set elementFormDefault="qualified" for generated wsdl?

Hi,
This is probably a basic CXF question but maybe you guys can help.
I have a simple SOAP service running in TomEE+ which generates its own wsdl based on some annotated java code.
This was created using this example:  http://openejb.apache.org/examples-trunk/simple-webservice/

This works great for stuff like SoapUI.  They have no problem with the service. So I think the service creating valid xml.

But when I create a simple command-line client using CXF 2.6.2, and generating the stubs using wsdl2java from the above mentioned wsdl.
None of the requests work!!
The only flag I use with wsdl2java when generating the code is:  -client

I always get some variation of this type of error:
[javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"jobControl"). Expected elements are <{http://dsa.cn.com/wsdl}jobControl>]

I can see on the generated wsdl this:
<xs:schema  elementFormDefault="unqualified" targetNamespace="http://dsa.cn.com/wsdl" version="1.0" xmlns:tns="http://dsa.cn.com/wsdl" xmlns:xs="http://www.w3.org/2001/XMLSchema">

And a sample of the response looks like this:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns2:getJobControlsResponse xmlns:ns2="http://dsa.cn.com/wsdl">
         <return>
            <jobControl id="a0ae00000000JoCAAU">
               <jobStart>2012/11/1 00:00:00</jobStart>
               <jobEnd>2012/11/1 23:59:59</jobEnd>
               <rangeStart>0</rangeStart>
               <rangeEnd>100</rangeEnd>
               <jobNote>updated via SOAP</jobNote>
               <jobStatus>START</jobStatus>
            </jobControl>
         . . .
            <jobControl id="a0ae00000000JspAAE">
               <jobStart>2012/12/1 00:00:00</jobStart>
               <jobEnd>2012/12/1 23:59:59</jobEnd>
               <rangeStart>0</rangeStart>
               <rangeEnd>500</rangeEnd>
               <jobNote>via REST service</jobNote>
               <jobStatus>START</jobStatus>
            </jobControl>
         </return>
      </ns2:getJobControlsResponse>
   </soap:Body>
</soap:Envelope>

So I don't know which is wrong, the client or the service??
Do the job <jobControl> elements need the namespace prepended to them?  Or is that not necessary since elementFormDefault="unqualified"?
The problem is, I don't understand the error msg that the client is giving me, since I don't think it should be expecting the uri it is expecting.
Is there a simple modification to either the service or the client to fix this?

Miles

--
Miles Poindexter
Data & Service Architecture
Condé Nast
ph: 212-790-6692
mobile: 347-967-8944
fax: 212-790-1891
miles_poindexter@condenast.com<ap...@condenast.com>



Re: set elementFormDefault="qualified" for generated wsdl?

Posted by "Poindexter, Miles" <Mi...@condenast.com>.
Well, I went back and took out all of the @WebResult annotations I had
added and so far the client is working fine now.
I will have to go back later and see how to properly use them.

miles




On 10/17/12 3:38 PM, "Poindexter, Miles" <Mi...@condenast.com>
wrote:

>Thanks Romain,
>That looks like the client code I'm trying.
>The error gets thrown when any "i.someBusinessMethod()"  get called.
>I guess I'm stumped because TomEE is using CXF 2.6.2 to generate the wsdl
>for the service.
>And then, I'm also using the same version of CXF to generate the stubs
>from the generated wsdl.
>So should not the operation calls on the client side "just work"? And not
>require any tweaking?
>Especially if a SOAP client like SoapUI has no problem calling operations
>on the service using the same wsdl?
>
>OK, I'll try to CXF forums . . .
>
>Miles
>
>-- 
>Miles Poindexter
>Data & Service Architecture
>Condé Nast
>ph: 212-790-6692
>mobile: 347-967-8944
>fax: 212-790-1891
>miles_poindexter@condenast.com
><applewebdata://6D7C2D39-4D16-42A7-8457-9A8FCE0ED464/miles_poindexter@cond
>e
>nast.com>
>
>
>
>
>
>On 10/17/12 11:58 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:
>
>>Hi,
>>
>>maybe ask cxf mailing list
>>
>>but a simple test if you have an interface is to use jaxws API:
>>
>>Service s = Service.create(wsdlUrl, qname);
>>MyInterface i = s.getPort(MyInterface.class);
>>i.someBusinessMethod();
>>
>>*Romain Manni-Bucau*
>>*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>>*Blog: 
>>**http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
>>*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>>*Github: https://github.com/rmannibucau*
>>
>>
>>
>>
>>2012/10/17 Poindexter, Miles <Mi...@condenast.com>
>>
>>> Hi,
>>> This is probably a basic CXF question but maybe you guys can help.
>>> I have a simple SOAP service running in TomEE+ which generates its own
>>> wsdl based on some annotated java code.
>>> This was created using this example:
>>> http://openejb.apache.org/examples-trunk/simple-webservice/
>>>
>>> This works great for stuff like SoapUI.  They have no problem with the
>>> service. So I think the service creating valid xml.
>>>
>>> But when I create a simple command-line client using CXF 2.6.2, and
>>> generating the stubs using wsdl2java from the above mentioned wsdl.
>>> None of the requests work!!
>>> The only flag I use with wsdl2java when generating the code is:
>>>-client
>>>
>>> I always get some variation of this type of error:
>>> [javax.xml.bind.UnmarshalException: unexpected element (uri:"",
>>> local:"jobControl"). Expected elements are <{
>>> http://dsa.cn.com/wsdl}jobControl>]
>>>
>>> I can see on the generated wsdl this:
>>> <xs:schema  elementFormDefault="unqualified" targetNamespace="
>>> http://dsa.cn.com/wsdl" version="1.0"
>>>xmlns:tns="http://dsa.cn.com/wsdl"
>>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>>
>>> And a sample of the response looks like this:
>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>    <soap:Body>
>>>       <ns2:getJobControlsResponse xmlns:ns2="http://dsa.cn.com/wsdl">
>>>          <return>
>>>             <jobControl id="a0ae00000000JoCAAU">
>>>                <jobStart>2012/11/1 00:00:00</jobStart>
>>>                <jobEnd>2012/11/1 23:59:59</jobEnd>
>>>                <rangeStart>0</rangeStart>
>>>                <rangeEnd>100</rangeEnd>
>>>                <jobNote>updated via SOAP</jobNote>
>>>                <jobStatus>START</jobStatus>
>>>             </jobControl>
>>>          . . .
>>>             <jobControl id="a0ae00000000JspAAE">
>>>                <jobStart>2012/12/1 00:00:00</jobStart>
>>>                <jobEnd>2012/12/1 23:59:59</jobEnd>
>>>                <rangeStart>0</rangeStart>
>>>                <rangeEnd>500</rangeEnd>
>>>                <jobNote>via REST service</jobNote>
>>>                <jobStatus>START</jobStatus>
>>>             </jobControl>
>>>          </return>
>>>       </ns2:getJobControlsResponse>
>>>    </soap:Body>
>>> </soap:Envelope>
>>>
>>> So I don't know which is wrong, the client or the service??
>>> Do the job <jobControl> elements need the namespace prepended to them?
>>>Or
>>> is that not necessary since elementFormDefault="unqualified"?
>>> The problem is, I don't understand the error msg that the client is
>>>giving
>>> me, since I don't think it should be expecting the uri it is expecting.
>>> Is there a simple modification to either the service or the client to
>>>fix
>>> this?
>>>
>>> Miles
>>>
>>> --
>>> Miles Poindexter
>>> Data & Service Architecture
>>> Condé Nast
>>> ph: 212-790-6692
>>> mobile: 347-967-8944
>>> fax: 212-790-1891
>>> miles_poindexter@condenast.com
>>> <applewebdata://6D7C2D39-4D16-42A7-8457-9A8FCE0ED464/
>>> miles_poindexter@condenast.com>
>>>
>>>
>>>
>
>



Re: set elementFormDefault="qualified" for generated wsdl?

Posted by "Poindexter, Miles" <Mi...@condenast.com>.
Thanks Romain,
That looks like the client code I'm trying.
The error gets thrown when any "i.someBusinessMethod()"  get called.
I guess I'm stumped because TomEE is using CXF 2.6.2 to generate the wsdl
for the service.
And then, I'm also using the same version of CXF to generate the stubs
from the generated wsdl.
So should not the operation calls on the client side "just work"? And not
require any tweaking?
Especially if a SOAP client like SoapUI has no problem calling operations
on the service using the same wsdl?

OK, I'll try to CXF forums . . .

Miles

-- 
Miles Poindexter
Data & Service Architecture
Condé Nast
ph: 212-790-6692
mobile: 347-967-8944
fax: 212-790-1891
miles_poindexter@condenast.com
<applewebdata://6D7C2D39-4D16-42A7-8457-9A8FCE0ED464/miles_poindexter@conde
nast.com>





On 10/17/12 11:58 AM, "Romain Manni-Bucau" <rm...@gmail.com> wrote:

>Hi,
>
>maybe ask cxf mailing list
>
>but a simple test if you have an interface is to use jaxws API:
>
>Service s = Service.create(wsdlUrl, qname);
>MyInterface i = s.getPort(MyInterface.class);
>i.someBusinessMethod();
>
>*Romain Manni-Bucau*
>*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
>*Blog: 
>**http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
>*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
>*Github: https://github.com/rmannibucau*
>
>
>
>
>2012/10/17 Poindexter, Miles <Mi...@condenast.com>
>
>> Hi,
>> This is probably a basic CXF question but maybe you guys can help.
>> I have a simple SOAP service running in TomEE+ which generates its own
>> wsdl based on some annotated java code.
>> This was created using this example:
>> http://openejb.apache.org/examples-trunk/simple-webservice/
>>
>> This works great for stuff like SoapUI.  They have no problem with the
>> service. So I think the service creating valid xml.
>>
>> But when I create a simple command-line client using CXF 2.6.2, and
>> generating the stubs using wsdl2java from the above mentioned wsdl.
>> None of the requests work!!
>> The only flag I use with wsdl2java when generating the code is:  -client
>>
>> I always get some variation of this type of error:
>> [javax.xml.bind.UnmarshalException: unexpected element (uri:"",
>> local:"jobControl"). Expected elements are <{
>> http://dsa.cn.com/wsdl}jobControl>]
>>
>> I can see on the generated wsdl this:
>> <xs:schema  elementFormDefault="unqualified" targetNamespace="
>> http://dsa.cn.com/wsdl" version="1.0" xmlns:tns="http://dsa.cn.com/wsdl"
>> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>
>> And a sample of the response looks like this:
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>    <soap:Body>
>>       <ns2:getJobControlsResponse xmlns:ns2="http://dsa.cn.com/wsdl">
>>          <return>
>>             <jobControl id="a0ae00000000JoCAAU">
>>                <jobStart>2012/11/1 00:00:00</jobStart>
>>                <jobEnd>2012/11/1 23:59:59</jobEnd>
>>                <rangeStart>0</rangeStart>
>>                <rangeEnd>100</rangeEnd>
>>                <jobNote>updated via SOAP</jobNote>
>>                <jobStatus>START</jobStatus>
>>             </jobControl>
>>          . . .
>>             <jobControl id="a0ae00000000JspAAE">
>>                <jobStart>2012/12/1 00:00:00</jobStart>
>>                <jobEnd>2012/12/1 23:59:59</jobEnd>
>>                <rangeStart>0</rangeStart>
>>                <rangeEnd>500</rangeEnd>
>>                <jobNote>via REST service</jobNote>
>>                <jobStatus>START</jobStatus>
>>             </jobControl>
>>          </return>
>>       </ns2:getJobControlsResponse>
>>    </soap:Body>
>> </soap:Envelope>
>>
>> So I don't know which is wrong, the client or the service??
>> Do the job <jobControl> elements need the namespace prepended to them?
>>Or
>> is that not necessary since elementFormDefault="unqualified"?
>> The problem is, I don't understand the error msg that the client is
>>giving
>> me, since I don't think it should be expecting the uri it is expecting.
>> Is there a simple modification to either the service or the client to
>>fix
>> this?
>>
>> Miles
>>
>> --
>> Miles Poindexter
>> Data & Service Architecture
>> Condé Nast
>> ph: 212-790-6692
>> mobile: 347-967-8944
>> fax: 212-790-1891
>> miles_poindexter@condenast.com
>> <applewebdata://6D7C2D39-4D16-42A7-8457-9A8FCE0ED464/
>> miles_poindexter@condenast.com>
>>
>>
>>



Re: set elementFormDefault="qualified" for generated wsdl?

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

maybe ask cxf mailing list

but a simple test if you have an interface is to use jaxws API:

Service s = Service.create(wsdlUrl, qname);
MyInterface i = s.getPort(MyInterface.class);
i.someBusinessMethod();

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*




2012/10/17 Poindexter, Miles <Mi...@condenast.com>

> Hi,
> This is probably a basic CXF question but maybe you guys can help.
> I have a simple SOAP service running in TomEE+ which generates its own
> wsdl based on some annotated java code.
> This was created using this example:
> http://openejb.apache.org/examples-trunk/simple-webservice/
>
> This works great for stuff like SoapUI.  They have no problem with the
> service. So I think the service creating valid xml.
>
> But when I create a simple command-line client using CXF 2.6.2, and
> generating the stubs using wsdl2java from the above mentioned wsdl.
> None of the requests work!!
> The only flag I use with wsdl2java when generating the code is:  -client
>
> I always get some variation of this type of error:
> [javax.xml.bind.UnmarshalException: unexpected element (uri:"",
> local:"jobControl"). Expected elements are <{
> http://dsa.cn.com/wsdl}jobControl>]
>
> I can see on the generated wsdl this:
> <xs:schema  elementFormDefault="unqualified" targetNamespace="
> http://dsa.cn.com/wsdl" version="1.0" xmlns:tns="http://dsa.cn.com/wsdl"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> And a sample of the response looks like this:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <ns2:getJobControlsResponse xmlns:ns2="http://dsa.cn.com/wsdl">
>          <return>
>             <jobControl id="a0ae00000000JoCAAU">
>                <jobStart>2012/11/1 00:00:00</jobStart>
>                <jobEnd>2012/11/1 23:59:59</jobEnd>
>                <rangeStart>0</rangeStart>
>                <rangeEnd>100</rangeEnd>
>                <jobNote>updated via SOAP</jobNote>
>                <jobStatus>START</jobStatus>
>             </jobControl>
>          . . .
>             <jobControl id="a0ae00000000JspAAE">
>                <jobStart>2012/12/1 00:00:00</jobStart>
>                <jobEnd>2012/12/1 23:59:59</jobEnd>
>                <rangeStart>0</rangeStart>
>                <rangeEnd>500</rangeEnd>
>                <jobNote>via REST service</jobNote>
>                <jobStatus>START</jobStatus>
>             </jobControl>
>          </return>
>       </ns2:getJobControlsResponse>
>    </soap:Body>
> </soap:Envelope>
>
> So I don't know which is wrong, the client or the service??
> Do the job <jobControl> elements need the namespace prepended to them?  Or
> is that not necessary since elementFormDefault="unqualified"?
> The problem is, I don't understand the error msg that the client is giving
> me, since I don't think it should be expecting the uri it is expecting.
> Is there a simple modification to either the service or the client to fix
> this?
>
> Miles
>
> --
> Miles Poindexter
> Data & Service Architecture
> Condé Nast
> ph: 212-790-6692
> mobile: 347-967-8944
> fax: 212-790-1891
> miles_poindexter@condenast.com
> <applewebdata://6D7C2D39-4D16-42A7-8457-9A8FCE0ED464/
> miles_poindexter@condenast.com>
>
>
>