Reputation: 1019
I have SOAP Request and also SOAP response in java code. In SOAP response I am getting <return>
statement using java code.
I want to modify my SOAP response : Instead of <return>
:::
I need it as
<userResponse> <userResponse>
<userId> <userId>
<image> <image>
can anybody help me out using java code to get the response for SOAP or any useful link to get example.
Upvotes: 1
Views: 1265
Reputation: 6905
Maybe I'm missing something here, but since you're coding the web service, can't you just modify the return string to be as you've indicated in your post? Using JAX-WS (http://docs.oracle.com/javaee/5/tutorial/doc/bnayn.html), you can return a result string in an XML-formatted style and then the client can consume your return string as it needs to.
You could have multiple, separate methods to return individual components if you needed to as well (one method for the userResponse, one for the userId, etc...).
For example (a very simple one)...
package some_package_for_your_web_service;
import javax.jws.WebService;
@WebService
public class SomeClassForYourWebService {
public void SomeClassForYourWebService() {}
@WebMethod
public String response() {
return "<response>" +
"<userResponse>a_response</userResponse>" +
"<userId>a_user_id</userId>" +
"<image>an_image_url</image>" +
"</response>";
}
}
Upvotes: 1