3 Replies Latest reply on Apr 9, 2014 6:40 AM by user13325925

    Can we call process wsdl from a java client?

    Brijesh Kumar Singh

      Hi,

      I have created one SampleProject in Oracle SOA BPM 11g. My Question is can we call this process wsdl from a java client?If yes then how, I was trying with below piece of code and I am getting below error message.

       

      Code:

      import javax.xml.soap.*;

      import javax.xml.transform.*;

      import javax.xml.transform.stream.*;

       

      public class NotificaionProcessCall {

          public NotificaionProcessCall() {

              super();

          }

       

          public static void main(String[] args) throws SOAPException, Exception {

      NotificaionProcessCall notificaionProcessCall =

                  new NotificaionProcessCall();

              try {

      notificaionProcessCall.soapCall("123", "google.com");

              } catch (Exception e) {

      System.out.println("Exception in NotificaionProcessCall is " +

      e.getMessage());

              }

       

          }

       

          public void soapCall(String docId, String path) throws Exception {

       

              // Create SOAP Connection

      SOAPConnectionFactory soapConnectionFactory =

      SOAPConnectionFactory.newInstance();

              SOAPConnection soapConnection =

      soapConnectionFactory.createConnection();

              String url =

      "http://localhost:7001/soa-infra/services/default/SampleProcess/SimpleProcess.service?WSDL";

              SOAPMessage soapResponse =

                  soapConnection.call(createSOAPRequest(docId, path), url);

       

          }

       

          private static SOAPMessage createSOAPRequest(String docId,

      String path) throws Exception {

              MessageFactory messageFactory = MessageFactory.newInstance();

              SOAPMessage soapMessage = messageFactory.createMessage();

              SOAPPart soapPart = soapMessage.getSOAPPart();

       

              // SOAP Envelope

              SOAPEnvelope envelope = soapPart.getEnvelope();

             

              // SOAP Body

              SOAPBody soapBody = envelope.getBody();

              SOAPElement startBody = soapBody.addChildElement("start");

      startBody.addNamespaceDeclaration("ns1",

      "http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess");

              SOAPElement soapBodyElem = startBody.addChildElement("CLPRequest");

      soapBodyElem.addNamespaceDeclaration("ns1",

      "http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess");

       

              SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("DocumentId");

      soapBodyElem1.addNamespaceDeclaration("ns2",

      "http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess");

       

      soapBodyElem1.addTextNode(docId);

              SOAPElement soapBodyElem2 = soapBodyElem.addChildElement(path);

      soapBodyElem2.addNamespaceDeclaration("ns2",

      "http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess");

       

       

      soapBodyElem2.addTextNode("google.com");

       

       

      soapMessage.saveChanges();

       

              /* Print the request message */

      System.out.print("Request SOAP Message = ");

      soapMessage.writeTo(System.out);

      System.out.println();

       

              return soapMessage;

          }

       

       

       

      }

       

       

      OUTPUT:

      Request SOAP Message = <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"><env:Header/><env:Body><start xmlns:ns1="http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess"><CLPRequest xmlns:ns1="http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess"><DocumentId xmlns:ns2="http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess">123</DocumentId><google.com xmlns:ns2="http://xmlns.oracle.com/bpmn/bpmnProcess/SimpleProcess">google.com</google.com></CLPRequest></start></env:Body></env:Envelope>

      Exception in NotificaionProcessCall is javax.xml.soap.SOAPException: Unsupported Content-Type: text/html

      1. com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: javax.xml.soap.SOAPException: Unsupported Content-Type: text/html

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:148)

                      at com.accenture.NotificaionProcessCall.soapCall(NotificaionProcessCall.java:34)

                      at com.accenture.NotificaionProcessCall.main(NotificaionProcessCall.java:16)

      Caused by: javax.xml.soap.SOAPException: Unsupported Content-Type: text/html

                      at weblogic.xml.saaj.SOAPMessageImpl.constructMessage(SOAPMessageImpl.java:256)

                      at weblogic.xml.saaj.SOAPMessageImpl.<init>(SOAPMessageImpl.java:151)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:76)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:63)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:55)

                      at weblogic.xml.saaj.MessageFactoryDynamicImpl.createMessage(MessageFactoryDynamicImpl.java:27)

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:328)

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:144)

                      ... 2 more

      CAUSE:

      javax.xml.soap.SOAPException: Unsupported Content-Type: text/html

                      at weblogic.xml.saaj.SOAPMessageImpl.constructMessage(SOAPMessageImpl.java:256)

                      at weblogic.xml.saaj.SOAPMessageImpl.<init>(SOAPMessageImpl.java:151)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:76)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:63)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:55)

                      at weblogic.xml.saaj.MessageFactoryDynamicImpl.createMessage(MessageFactoryDynamicImpl.java:27)

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:328)

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:144)

                      at com.accenture.NotificaionProcessCall.soapCall(NotificaionProcessCall.java:34)

                      at com.accenture.NotificaionProcessCall.main(NotificaionProcessCall.java:16)

       

      CAUSE:

       

      1. javax.xml.soap.SOAPException: Unsupported Content-Type: text/html

                      at weblogic.xml.saaj.SOAPMessageImpl.constructMessage(SOAPMessageImpl.java:256)

                      at weblogic.xml.saaj.SOAPMessageImpl.<init>(SOAPMessageImpl.java:151)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:76)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:63)

                      at weblogic.xml.saaj.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:55)

                      at weblogic.xml.saaj.MessageFactoryDynamicImpl.createMessage(MessageFactoryDynamicImpl.java:27)

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:328)

                      at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:144)

                      at com.accenture.NotificaionProcessCall.soapCall(NotificaionProcessCall.java:34)

                      at com.accenture.NotificaionProcessCall.main(NotificaionProcessCall.java:16)

      Process exited with exit code 0.

       

       

      Thanks,

      Brijesh Kumar Singh