users@jersey.java.net

[Jersey] Re: RESTful POST request cannot call SOAP web service, but RESTful GET can

From: Kevin Duffey <andjarnic_at_yahoo.com>
Date: Sun, 12 Jan 2014 20:24:29 -0800 (PST)

Are you able to even get into the method? I don't see any logging our System.out calls.. so I am assuming you've at this point done something like that to make sure the method is called and thus failing within the code of the method. If you're not getting the method called at all, make sure the Content-Type is set correctly. You also may want to add an @Consumes(). If you're using a specificy type of your own, does it contain JAXB annotations so that Jersey can convert it from xml or json in to your class?






On Sunday, January 12, 2014 10:22 AM, Dean Schulze <dean.w.schulze_at_gmail.com> wrote:
 
My code is below.  The only thing it does besides creating a calling a SOAP client is setting the URL (to dev/test or prod depending on where it is deployed).  Right now the setUrl() just sets it to the dev URL which is the same URL the client code was generated from.
>
>
>The same code works if it is called with a @GET (using QueryParams instead of the RemedyRecord input object).  The client code works when it is called from a standalone main() method or a JUnit test.
>
>
>The @POST fails on both Tomcat 6.1 and Jetty 9.1.
>
>
>
>Any insights would be appreciated.
>
>
>@POST
>@Produces(MediaType.APPLICATION_JSON)
>@Path("/createRemedyRecord")
>public ReturnCode createRemedyRecord (RemedyRecord rr) {
>ReturnCode rc = new ReturnCode();
>
>
>MTPRegisteredProductService ws = new MTPRegisteredProductService();
>PortPortType ppt = ws.getPortSoap();
>setUrl(ppt);
>try {
>String contactId = rr.contactId + "";
>AuthenticationInfo authInfo = new AuthenticationInfo();
>    authInfo.setUserName(...);
>    authInfo.setPassword(...);
>    ppt.create(
>rr.serialNumber, 
>rr.partNumber, 
>"", 
>"", 
>rr.salesOrderNumber, 
>contactId, 
>"", 
>"", 
>"", 
>"", 
>"", 
>"Single",
>authInfo);
>    
>    String s = "Call to Remedy create() succeded.";
>logger.info(s);
>rc.errorCode = 0;
>rc.status = s;
>} catch (Exception e) {
>String s = "Call to Remedy create() failed.";
>logger.info(s);
>logger.error(e);
>rc.errorCode=1;
>rc.message += ".  Error:  " + e.getMessage();
>rc.status=s;
>}
>
>
>return rc;
>}
>
>
>
>
>
>On Sat, Jan 11, 2014 at 5:19 PM, Ted M. Young [@jitterted] <tedyoung_at_gmail.com> wrote:
>
>Hi Dean,
>>
>>
>>I'm a bit confused with what you're trying to do, so code (or even better, a pointer to a GitHub repo or a Gist) would help, along with stack traces or information about what connection is timing out. I've done simple Web API POSTs as facades for SOAP, so there's no inherent problem here.
>>
>>
>>It's true that SOAP calls are done as POSTs, but I'm not sure if that's relevant.
>>
>>
>>JavaScript _could_ call a SOAP web service, but you probably don't want to do that (it's really cumbersome).
>>
>>
>>;ted
>>--
>>http://about.me/tedmyoung
>>
>>
>>
>>
>>
>>
>>On Sat, Jan 11, 2014 at 9:55 AM, Dean Schulze <dean.w.schulze_at_gmail.com> wrote:
>>
>>I've got a simple RESTful web service (3 GET methods and 1 POST method).  The POST method creates a SOAP web service client and makes one web service call.  The RESTful POST is just a facade that is easy to call from jQuery.  (I don't know if Javascript can call a SOAP web service.)
>>>
>>>
>>>The SOAP client works standalone so I know it is correct.  
>>>
>>>
>>>When I make the RESTful POST request the SOAP client call always times out.  I added a GET method that makes the same SOAP client call and it works, however.
>>>
>>>
>>>I've gotten the same results when deployed on Tomcat 6.1 and Jetty 9.1 so I don't think this is a limitation of one web server implementation.
>>>
>>>
>>>What have I run into? I've heard that SOAP calls are actually POSTs so maybe you can't make a POST from a POST, but I don't know why.
>>>
>>>
>>>I would think that a RESTful facade to a SOAP call would be fairly common but I couldn't find any mention of this problem and I would like to understand why a GET can call a SOAP client while a POST cannot.
>>>
>>>
>>>Thanks.
>>>
>>>
>>>
>>>
>>
>
>
>