Note that there are some explanatory texts on larger screens.

plurals
  1. POConsuming Spring (SOAP) web service in a java servlet
    text
    copied!<p>Is there any way to consume a SOAP based Spring web service without generating stubs on the client (as suggested by umpteen threads pointing to JAX-WS)? </p> <p>Here is my complete scenario:</p> <p>I have 2 web applications, say APP1 &amp; APP2, both of which have Spring support. APP2 exposes it's APIs as Spring-WS that accept POJOs (Reqeust and Response objects) via. SOAP. Now, I want to call these web services from APP1, but would like to avoid having to create stubs using the WSDL frmo APP2. Is this possible? </p> <p>For more detail, here is one of my web service's operation:</p> <pre><code>@PayloadRoot(localPart = "CreateNewRequest", namespace = "myNameSpace") public CreateNewReqResponse createNewRequest( CreateNewReqRequest requestObj ) throws Exception { NewCase newCase = this.localSpringService.createNewCase( requestObj.getParam1(), requestObj.getParam2() ); CreateNewReqResponse response = this.objectFactory.createCreateNewReqResponse(); CreateNewReqResponseObject responseObject = this.objectFactory .createCreateNewReqResponseObject(); if( null != newCase ) { responseObject.setParam1( newCase.getParam1() ); responseObject.setParam2( newCase.setParam2() ); } responseObject.setCaseRequestedDate( caseRequestedDate ); } response.setResponseObject( responseObject ); return response; } </code></pre> <p>Now, as you can see, the web service method accepts CreateNewReqRequest and returns CreateNewReqResponse. What I am trying to figure out is how can I call this web service from APP1, which does not have any clue about these classes - CreateNewReqRequest and CreateNewReqResponse? Is there no other way other than creating stubs in APP1 (from the WSDL) using JAX-WS?</p> <p>Both the applications in question are our own (that is we have developed them) but run on different servers, because of which APP1 can not call the web service directly - cross-domain policy. Hence, I will writing a servlet in APP1 which will consume the web service exposed by APP2.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload