You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by rm-ramos <rm...@criticalsoftware.com> on 2007/12/04 13:25:55 UTC

CXF2.0+JBoss namespace issue with custom objects

Hi all,

I'm trying to enter this beautiful world of deploying  CXF WS in JBoss, but
I'm having some namespace issues with the XML I get as an answer, from the
WS. 

I created a code first service, with the following service endpoint
interface:


@WebService(name="GetWorkOrderService",
targetNamespace="http://webservice.api.wow/")
public interface GetWorkOrderService {

@WebMethod
@WebResult(targetNamespace="", name = "simpleWODetails")
public simpleWODetails get(@WebParam(name = "workOrderId") Integer
workOrderId);


The 'get' method's impletation will then return a simpleWODetails' object,
which is only formed by pojo's. Of course, I have my impl annotated with:
@WebService(endpointInterface =
"com.criticalsoftware.wow.GetWorkOrderService")

On generating the WSDL, via java2wsdl, everything goes fine, but when I
tested the service on soapUI, the XML returned didn't validate. It went
something like:

#1 - Request


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:web="http://webservice.api.wow/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:get>
         <workOrderId>4054</workOrderId>
      </web:get>
         (...)


#2 - Response


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <getResponse xmlns="http://webservice.api.wow/">
         <ns2:simpleWODetails xmlns:ns2="http://webservice.api.wow/">
            <changeUserId>369</changeUserId>
            (....)


The validation outputs that 'Expected element 'simpleWODetails instead of
simpleWODetails@http://webservice.api.wow/', even though I already set up
the answer's targetNamespace to "" (in the SEI). The strange thing is that I
can change it to anything else (if I set the targetNamespace to "x.y.z", it
does change in the answer), but I just can't clear it.

As a result, all the calls I make with the stubs generated from the WSDL 
return null, since they can't find the object with the correct (empty)
namespace on the answer.

Hope you guys can help me out, been stuck on this for some days now...
Thanks!
Rui Ramos

-- 
View this message in context: http://www.nabble.com/CXF2.0%2BJBoss-namespace-issue-with-custom-objects-tf4942815.html#a14149710
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF2.0+JBoss namespace issue with custom objects

Posted by rm-ramos <rm...@criticalsoftware.com>.
Thank you both! 
I has in fact still using 2.0.0 and upgrading did the trick for me.

Thanks once again :)
Rui Ramos
-- 
View this message in context: http://www.nabble.com/CXF2.0%2BJBoss-namespace-issue-with-custom-objects-tf4942815.html#a14164218
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF2.0+JBoss namespace issue with custom objects

Posted by rm-ramos <rm...@criticalsoftware.com>.
Thank you both! 
I was in fact still using 2.0.0 and upgrading did the trick for me.

Thanks once again :)
Rui Ramos
-- 
View this message in context: http://www.nabble.com/CXF2.0%2BJBoss-namespace-issue-with-custom-objects-tf4942815.html#a14164218
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF2.0+JBoss namespace issue with custom objects

Posted by Daniel Kulp <dk...@apache.org>.
Actually, if you HAVE to use 2.0 or 2.0.1, you can probably get it 
working properly by calling java2wsdl with the -s and -c flags specified 
to have it generate some wrapper beans.  (It should generate a Get bean 
and a GetResponse bean)   Then re-annotate the method with 
@RequestWrapper and @ResponseWrapper annotations to have it use those 
beans.   (and you could add a wsdlLocation attribute to the @WebService 
annotation as well)    JAXB can then do the entire writing of the body 
using the schema.   That should allow the messages to be correct.

That all said, updating to 2.0.3 is probably easier.  :-)

Dan


On Tuesday 04 December 2007, Daniel Kulp wrote:
> What version of CXF are you using?   The response message looks like
> it was generated with 2.0 or 2.0.1.   I would definitely suggest
> upgrading to 2.0.3 which should fix the problem.
>
> Dan
>
> On Tuesday 04 December 2007, rm-ramos wrote:
> > Hi all,
> >
> > I'm trying to enter this beautiful world of deploying  CXF WS in
> > JBoss, but I'm having some namespace issues with the XML I get as an
> > answer, from the WS.
> >
> > I created a code first service, with the following service endpoint
> > interface:
> >
> >
> > @WebService(name="GetWorkOrderService",
> > targetNamespace="http://webservice.api.wow/")
> > public interface GetWorkOrderService {
> >
> > @WebMethod
> > @WebResult(targetNamespace="", name = "simpleWODetails")
> > public simpleWODetails get(@WebParam(name = "workOrderId") Integer
> > workOrderId);
> >
> >
> > The 'get' method's impletation will then return a simpleWODetails'
> > object, which is only formed by pojo's. Of course, I have my impl
> > annotated with: @WebService(endpointInterface =
> > "com.criticalsoftware.wow.GetWorkOrderService")
> >
> > On generating the WSDL, via java2wsdl, everything goes fine, but
> > when I tested the service on soapUI, the XML returned didn't
> > validate. It went something like:
> >
> > #1 - Request
> >
> >
> > <soapenv:Envelope
> > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:web="http://webservice.api.wow/">
> >    <soapenv:Header/>
> >    <soapenv:Body>
> >       <web:get>
> >          <workOrderId>4054</workOrderId>
> >       </web:get>
> >          (...)
> >
> >
> > #2 - Response
> >
> >
> > <soap:Envelope
> > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body>
> >       <getResponse xmlns="http://webservice.api.wow/">
> >          <ns2:simpleWODetails
> > xmlns:ns2="http://webservice.api.wow/">
> > <changeUserId>369</changeUserId>
> >             (....)
> >
> >
> > The validation outputs that 'Expected element 'simpleWODetails
> > instead of simpleWODetails@http://webservice.api.wow/', even though
> > I already set up the answer's targetNamespace to "" (in the SEI).
> > The strange thing is that I can change it to anything else (if I set
> > the targetNamespace to "x.y.z", it does change in the answer), but I
> > just can't clear it.
> >
> > As a result, all the calls I make with the stubs generated from the
> > WSDL return null, since they can't find the object with the correct
> > (empty) namespace on the answer.
> >
> > Hope you guys can help me out, been stuck on this for some days
> > now... Thanks!
> > Rui Ramos



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: CXF2.0+JBoss namespace issue with custom objects

Posted by Daniel Kulp <dk...@apache.org>.
What version of CXF are you using?   The response message looks like it 
was generated with 2.0 or 2.0.1.   I would definitely suggest upgrading 
to 2.0.3 which should fix the problem.

Dan


On Tuesday 04 December 2007, rm-ramos wrote:
> Hi all,
>
> I'm trying to enter this beautiful world of deploying  CXF WS in
> JBoss, but I'm having some namespace issues with the XML I get as an
> answer, from the WS.
>
> I created a code first service, with the following service endpoint
> interface:
>
>
> @WebService(name="GetWorkOrderService",
> targetNamespace="http://webservice.api.wow/")
> public interface GetWorkOrderService {
>
> @WebMethod
> @WebResult(targetNamespace="", name = "simpleWODetails")
> public simpleWODetails get(@WebParam(name = "workOrderId") Integer
> workOrderId);
>
>
> The 'get' method's impletation will then return a simpleWODetails'
> object, which is only formed by pojo's. Of course, I have my impl
> annotated with: @WebService(endpointInterface =
> "com.criticalsoftware.wow.GetWorkOrderService")
>
> On generating the WSDL, via java2wsdl, everything goes fine, but when
> I tested the service on soapUI, the XML returned didn't validate. It
> went something like:
>
> #1 - Request
>
>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:web="http://webservice.api.wow/">
>    <soapenv:Header/>
>    <soapenv:Body>
>       <web:get>
>          <workOrderId>4054</workOrderId>
>       </web:get>
>          (...)
>
>
> #2 - Response
>
>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <getResponse xmlns="http://webservice.api.wow/">
>          <ns2:simpleWODetails xmlns:ns2="http://webservice.api.wow/">
>             <changeUserId>369</changeUserId>
>             (....)
>
>
> The validation outputs that 'Expected element 'simpleWODetails instead
> of simpleWODetails@http://webservice.api.wow/', even though I already
> set up the answer's targetNamespace to "" (in the SEI). The strange
> thing is that I can change it to anything else (if I set the
> targetNamespace to "x.y.z", it does change in the answer), but I just
> can't clear it.
>
> As a result, all the calls I make with the stubs generated from the
> WSDL return null, since they can't find the object with the correct
> (empty) namespace on the answer.
>
> Hope you guys can help me out, been stuck on this for some days now...
> Thanks!
> Rui Ramos



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: CXF2.0+JBoss namespace issue with custom objects

Posted by rm-ramos <rm...@criticalsoftware.com>.
I forgot to leave you the generated WSDL, from java2wsdl. 

For convenience, I posted it online instead of pasting the full code here. 
You can access it here:
 -  http://student.dei.uc.pt/~rmramos/GetWorkOrderWebService.wsdl
http://student.dei.uc.pt/~rmramos/GetWorkOrderWebService.wsdl 

Thanks again,
Rui Ramos
-- 
View this message in context: http://www.nabble.com/CXF2.0%2BJBoss-namespace-issue-with-custom-objects-tf4942815.html#a14151295
Sent from the cxf-user mailing list archive at Nabble.com.