Hi Sergey, I think I may have managed to fix the issue, it was coming from my request packet. For some reason, JAXB doesn't find the following two elements the same.
<mmsBillingRequest xmlns="http://www.mmsLogDetails.products.pams.co.za"> <originatorMsisdn>27829801407</originatorMsisdn> versus <ns2:mmsBillingRequest xmlns:ns2=" http://www.mmsLogDetails.products.pams.co.za"> <originatorMsisdn>27829801407</originatorMsisdn> To me, these two xml snippets are equivalent, not sure why they don't work the same. So I've reverted to the code you expected to work: @POST @Consumes({ MediaType.APPLICATION_XML }) @Produces({ MediaType.APPLICATION_XML }) @Path("mmsBilling") public Response execute(MmsBillingRequest request) throws Exception { Regards Kiren On Sun, Nov 10, 2013 at 11:54 PM, Sergey Beryozkin <[email protected]>wrote: > Hi Kiren > Can you please open a JIRA and attach your project there ? > > Thanks, Sergey > > On 10/11/13 20:58, Kiren Pillay wrote: > >> Hi Sergey, >> >> Where can I upload the test project? >> >> Regards >> Kiren >> >> >> On Sun, Nov 3, 2013 at 7:04 PM, Sergey Beryozkin <[email protected] >> >wrote: >> >> Hi >>> >>> This is very strange. I think something is interfering into the process, >>> can you please create a basic test project reproducing the issue, very >>> odd >>> indeed >>> >>> Thanks, Sergey >>> >>> On 02/11/13 15:23, Kiren Pillay wrote: >>> >>> Thanks. I removed the QueryPAram as below, >>>> >>>> @POST >>>> @Consumes({ MediaType.APPLICATION_XML }) >>>> @Produces({ MediaType.APPLICATION_XML }) >>>> @Path("mmsBilling") >>>> public Response execute(MmsBillingRequest request) throws >>>> Exception { >>>> >>>> >>>> Now I get a strange error: >>>> >>>> Caused by: javax.xml.bind.UnmarshalException: unexpected element >>>> (uri:"", >>>> local:"MmsBillingRequest"). Expected elements are <{ >>>> http://www.messaging.pams.xxx/response}Response>. >>>> >>>> Which is odd because the only part of my method signature with the >>>> Response >>>> type is the return, so not sure why the unMarshaller is expecting the >>>> Response Type. >>>> >>>> Looking at my WADL for this operation:<resources base=" >>>> http://localhost:8080/RESTWEB/rest/"> >>>> <resource path="/function"> >>>> <resource path="/mmsBilling"> >>>> <method name="POST"> >>>> <request> >>>> <representation mediaType="application/xml" /> >>>> </request> >>>> <response> >>>> <representation mediaType="application/xml" >>>> element="prefix1:Response" /> >>>> </response> >>>> </method> >>>> </resource> >>>> </resource> >>>> >>>> Is there maybe a way to define the type of the request/response in an >>>> annotation? I'm guessing that may help? >>>> >>>> My request: >>>> <MmsBillingRequest> >>>> <originatorMsisdn>27831231231 >>>> </originatorMsisdn> >>>> </MmsBillingRequest> >>>> >>>> >>>> >>>> On Fri, Nov 1, 2013 at 1:08 PM, Sergey Beryozkin <[email protected] >>>> >>>>> wrote: >>>>> >>>> >>>> Hi >>>> >>>>> >>>>> You have a QueryParam attached to a parameter which is expected to >>>>> represent a message body, so no attempt to read the stream is attempted >>>>> >>>>> Thanks, Sergey >>>>> >>>>> On 01/11/13 07:31, Kiren Pillay wrote: >>>>> >>>>> HI All, >>>>> >>>>>> >>>>>> I need to post an XML entity to a restful web-service, however my >>>>>> service >>>>>> isn't picking up the request for some reason, I'm getting a null value >>>>>> for >>>>>> my request. >>>>>> >>>>>> Can someone please guide me in the right direction. I'm using the >>>>>> JAXB >>>>>> Provider. >>>>>> >>>>>> Here's my service: >>>>>> >>>>>> @POST >>>>>> @Produces({ MediaType.APPLICATION_XML }) >>>>>> public Response execute(@QueryParam("") MmsBillingRequest >>>>>> request) >>>>>> throws Exception { >>>>>> System.err.println("REQUEST RECEIVED"); >>>>>> Response response = new Response(); >>>>>> try { >>>>>> request.getOriginatorInterface(); >>>>>> >>>>>> >>>>>> My Test Client: >>>>>> >>>>>> String xmlRequest = "<MmsBillingRequest> " >>>>>> + " <originatorMsisdn>27823339811 >>>>>> </originatorMsisdn>" >>>>>> + " <originatorInterface />" + " >>>>>> <payloadSize/>" >>>>>> + " <messageClass/>" + " >>>>>> <readRepRequested/>" >>>>>> + " <timeStamp/>" + " <recipients/>" >>>>>> + "</MmsBillingRequest>"; >>>>>> >>>>>> // **************** >>>>>> >>>>>> WebClient wc = WebClient.create( >>>>>> >>>>>> " >>>>>> http://localhost:9090/deploy-mms-billing/rest//function/mmsBilling", >>>>>> "test", "test", null); >>>>>> >>>>>> wc.type("application/xml"). >>>>>> accept("application/xml"); >>>>>> >>>>>> >>>>>> >>>>>> long l1 = System.currentTimeMillis(); >>>>>> // Response response = wc.get(Response.class); >>>>>> Response response = wc.post(xmlRequest); >>>>>> System.out.println(response.getEntity()); >>>>>> >>>>>> >>>>>> Regards >>>>>> Kiren >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>> Sergey Beryozkin >>>>> >>>>> Talend Community Coders >>>>> http://coders.talend.com/ >>>>> >>>>> Blog: http://sberyozkin.blogspot.com >>>>> >>>>> >>>>> >>>> >>> -- >>> Sergey Beryozkin >>> >>> Talend Community Coders >>> http://coders.talend.com/ >>> >>> Blog: http://sberyozkin.blogspot.com >>> >>> >> > > -- > Sergey Beryozkin > > Talend Community Coders > http://coders.talend.com/ > > Blog: http://sberyozkin.blogspot.com >
