How do I establish communication between two SOAP web services?
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I am learning on the job how to set up communication between two SOAP web services, WCS and NDC.

The WSDL files for the two services can be found at: (NDC web service) (WCS client service)

Here I try to represent a basic cycle:

WCS                                  NDC
 |                                    |
 |                                    |\
 |                                    | some internal operations
 |                                    |/
 |          OrderAccepted             |
 |                                    |
 |                                    |
 |     Acknowledge OrderAccepted      |
 |                                    |

Based on tutorials I found via Google, I have managed to set up in Eclipse a test WCS web service client project. I used wsimport on the NDC WSDL file, copied the generated .java files to my project, and then modified my client accordingly - please see below.

import javax.xml.bind.JAXBElement;

import org.datacontract.schemas._2004._07.ndc_webservices.NDCServiceIsConnectedResp;

import com.dematic.ndcwebservices.*;

public class AciServiceClient {

    public static void main(String[] args) {
        AciService service = new AciService();
        IAciService is = service.getCustomBindingIAciService();
        ObjectFactory of = new ObjectFactory();

         * Start request
        StartRequest reqStart = of.createStartRequest();
        JAXBElement<String> hostIP = of.createStartRequestHostIPAddress("");
        NDCServiceResponse resp = is.start(reqStart);
        NDCServiceResp rez = resp.getResponse().getValue();
        // error handling
        if (rez.isIsError()) {
            String errMsg = rez.getMessage().getValue();

         * Check if connected
        CheckIsConnectedRequest reqCheckCon = of.createCheckIsConnectedRequest();
        NDCServiceIsConnectedResponse respCheckCon = is.checkIsConnected(reqCheckCon);
        JAXBElement<NDCServiceIsConnectedResp> r = respCheckCon.getResponse();
        NDCServiceIsConnectedResp r2 = r.getValue();
        if (r2.isIsConnected()) {
            // do thing
        else {
            if (r2.isIsError()) {
            else {
                // if not connected and no error, simply start the connection again


I have also written a custom SOAPHandler to modify the request header with authentication information, but I don't think that is relevant to this question (you can ask for it though).

Based on the client code above, I am able to initiate contact from WCS to NDC. However, I am not sure how to integrate the second part, where I need to listen for messages from NDC and acknowledge them from WCS.


Java source with barebone code and comments on how to (in this example) listen for AciProcess_S_MessageReceived() and call SendAck() - either full code here, or .java file(s) for download.

Please take into account that I am a beginner to web services. I would like to learn as much as possible from the solution, ELI5..

Tip for extras

All my code so far is untested, because I do not have the necessary information yet. If you see any mistakes or bad practices in my code above, please point them out to me.

20 days ago

Crowdsource coding tasks.

0 Solutions