问题
I have written a SOAP WSDL application using mobilefirst by:
1) Using the Discover backend services option
2) Writing my own JavaScript adapter code to follow the documentation provided by IBM.
Now my final R&D is to consume this soap service using a java adapter.
I have gone through many StackOverflow topics and samples but I haven't been able to find anything related. Can anyone explain the steps to invoke a SOAP-based webservice request using java adapter?
回答1:
The following video blog post details the following about Java adapers: https://www.youtube.com/watch?v=cKM5480-6wI
- Creating Java Adapter
- Understanding Java Adapter structure
- Implementing simple sayHello procedure for HTTP GET method
- Implementing several procedures for different HTTP methods
- Working with various types of request parameters
- Using Java code to access MobileFirst server functionality and Java servlet functionality
- Debugging Java Adapters
- Communicating with a simple backend using using Apache HTTP Client
- Leveraging WSDL files and communicating with a SOAP based webservice
- Using WLResourceRequest in client applications to communicate with Java Adapters
- Using Postman REST client for communicating with Java Adapters
回答2:
- Create HTTP Adapter
- In xml add WebService Host and Port in Domain/Port elements
- Assemble soapXMLRequest
- Use HTTP Invoke to call server
ex.
var input = {
method : 'post',
returnedContentType : 'xml',
headers : {
SOAPAction : SOAP_FULL_URL
},
path : WEBSERVICE_PATH,
body : {
content : soapXMLRequest,
contentType : 'text/xml; charset=utf-8'
}
};
var response = WL.Server.invokeHttp(input);
来源:https://stackoverflow.com/questions/35033095/accessing-soap-service-using-java-adapter-in-mobilefirst