0 Replies Latest reply: Jun 11, 2009 2:40 AM by 702031 RSS

    send sms request cannot be processed after calling sendSms webservice.

    702031
      Hi All,

      I have created one test client that gets the session ID from oracle gatekeeper session webservice and then I am calling the sendSms webservice to send the SMS.

      My Test Client is:

      TestClientt.java gets the session ID successfully

      --------------------------------------------------------------------------------
      package test;

      import java.net.URL;

      import javax.xml.namespace.QName;
      import javax.xml.soap.MessageFactory;
      import javax.xml.soap.SOAPBody;
      import javax.xml.soap.SOAPBodyElement;
      import javax.xml.soap.SOAPConnection;
      import javax.xml.soap.SOAPConnectionFactory;
      import javax.xml.soap.SOAPElement;
      import javax.xml.soap.SOAPEnvelope;
      import javax.xml.soap.SOAPHeader;
      import javax.xml.soap.SOAPMessage;
      import javax.xml.soap.SOAPPart;

      public class TestClientt {

      public static void main(String[] args) {
      try {

      SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();
      SOAPConnection connection = sfc.createConnection();

      MessageFactory messageFactory = MessageFactory.newInstance();
      SOAPMessage message = messageFactory.createMessage();

      SOAPPart soapPart = message.getSOAPPart();

      SOAPEnvelope soapEnvelope = soapPart.getEnvelope();

      SOAPHeader header = soapEnvelope.getHeader();
      SOAPBody sb = message.getSOAPBody();
      QName bodyName = new QName(
      "http://www.bea.com/wsdl/wlcp/wlng/session_manager/service",
      "getSession", "ser");
      SOAPBodyElement bodyElement = sb.addBodyElement(bodyName);

      SOAPElement security =

      header
      .addChildElement(
      "Security",
      "wssp",
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");

      SOAPElement usernameToken =

      security.addChildElement("UsernameToken", "wssp");

      usernameToken
      .addAttribute(
      new QName("xmlns:wsp"),
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");

      SOAPElement username =

      usernameToken.addChildElement("Username", "wssp");

      usernameToken
      .setAttribute(
      "Type",
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken");

      username.addTextNode("sdpai");

      SOAPElement password =

      usernameToken.addChildElement("Password", "wssp");

      password
      .setAttribute(
      "Type",
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");

      password.addTextNode("sdp");

      URL endpoint = new URL(
      "http://localhost:8001/session_manager/SessionManager");
      System.out.println("\n Soap Request:\n");
      message.writeTo(System.out);
      System.out.println();
      SOAPMessage response = connection.call(message, endpoint);
      System.out.println("\n Soap Response:\n");
      response.writeTo(System.out);
      String resp = null;
      resp = response.getSOAPBody().getLastChild().getLastChild()
      .toString();

      System.out.println();
      connection.close();

      System.out.println("Session ID" + resp);
      int start = resp.indexOf("app:");
      int end = resp.indexOf("</ser:getSessionReturn>");
      String sessionID = resp.substring(start, end);
      System.out.println("Session ID" + sessionID);

      test3 test = new test3();
      test.responseSms(sessionID);

      } catch (Exception e) {

      e.printStackTrace();
      }

      }

      }


      test3.java http://Called by TestClientt.java after and passing sessionID to it



      --------------------------------------------------------------------------------

      package test;

      import java.net.URL;

      import javax.xml.namespace.QName;
      import javax.xml.soap.MessageFactory;
      import javax.xml.soap.SOAPBody;
      import javax.xml.soap.SOAPBodyElement;
      import javax.xml.soap.SOAPConnection;
      import javax.xml.soap.SOAPConnectionFactory;
      import javax.xml.soap.SOAPElement;
      import javax.xml.soap.SOAPEnvelope;
      import javax.xml.soap.SOAPHeader;
      import javax.xml.soap.SOAPHeaderElement;
      import javax.xml.soap.SOAPMessage;
      import javax.xml.soap.SOAPPart;

      public class test3 {

      public void responseSms(String sessionID) {
      try {

      SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();
      SOAPConnection connection = sfc.createConnection();

      MessageFactory messageFactory = MessageFactory.newInstance();
      SOAPMessage message = messageFactory.createMessage();

      SOAPPart soapPart = message.getSOAPPart();

      SOAPEnvelope soapEnvelope = soapPart.getEnvelope();

      SOAPHeader header = soapEnvelope.getHeader();
      SOAPBody sb = message.getSOAPBody();

      QName bodyName1 = new QName(
      "http://www.csapi.org/schema/parlayx/sms/send/v2_2/local",
      "sendSms");
      SOAPBodyElement bodyElement = sb.addBodyElement(bodyName1);

      QName qn = new QName("addresses");
      SOAPElement selem3 = bodyElement.addChildElement(qn);

      selem3.addTextNode("tel:1234");

      QName qn1 = new QName("message");
      SOAPElement selem4 = bodyElement.addChildElement(qn1);
      selem4.addTextNode("This is a Test Message From Naveen");

      SOAPElement security =

      header
      .addChildElement(
      "Security",
      "wssp",
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");

      SOAPElement usernameToken =

      security.addChildElement("UsernameToken", "wssp");

      usernameToken
      .addAttribute(
      new QName("xmlns:wsp"),
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");

      SOAPElement username =

      usernameToken.addChildElement("Username", "wssp");

      usernameToken
      .setAttribute(
      "Type",
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken");

      username.addTextNode("sdpai");

      SOAPElement password =

      usernameToken.addChildElement("Password", "wssp");

      password
      .setAttribute(
      "Type",
      "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");

      password.addTextNode("sdp");

      QName headerName1 = new QName("Session");
      SOAPHeaderElement headerElement2 = header
      .addHeaderElement(headerName1);
      QName qn4 = new QName("SessionId");
      SOAPElement selem6 = headerElement2.addChildElement(qn4);
      selem6.addTextNode(sessionID);

      System.out.println("\n Soap Request:\n");
      message.writeTo(System.out);
      System.out.println();

      URL endpoint = new URL(
      "http://localhost:8001/parlayx21/sms/SendSms");

      SOAPMessage response = connection.call(message, endpoint);
      System.out.println("\n Soap Response:\n");
      response.writeTo(System.out);
      connection.close();
      } catch (Exception ex) {
      ex.printStackTrace();
      }
      }
      }



      I am getting the error at line:

      SOAPMessage response = connection.call(message, endpoint);

      and the error is:

      javax.xml.soap.SOAPException:
      at org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(SOAPConnectionImpl.java:194)
      at org.apache.axis2.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:130)
      at test.test3.responseSms(test3.java:103)
      at test.TestClientt.main(TestClientt.java:100)
      Caused by: org.apache.axis2.AxisFault:
      at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
      at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
      at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
      at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)


      in OCSG trace logs, it shows:

      10 Jun 2009 18:05:00,455 [ WARN com.bea.wlcp.wlng.util.EJBHelper - Failed to process request
      com.bea.wlcp.wlng.api.plugin.DenyPluginException: org.csapi.schema.parlayx.common.v2_1.ServiceException
      at com.bea.wlcp.wlng.interceptor.ValidateRequestUsingRequestFactory.invoke(ValidateRequestUsingRequestFactory.java:38)
      at com.bea.wlcp.wlng.interceptor.ContextImpl.invokeNext(ContextImpl.java:87)
      at com.bea.wlcp.wlng.interceptor.EnforceSpAppBudget.invoke(EnforceSpAppBudget.java:70)
      at com.bea.wlcp.wlng.interceptor.ContextImpl.invokeNext(ContextImpl.java:87)

      ************************************

      Please let me know what the issue is. To my surprise the soap message which I am getting thru test3.java is successfully returning the response in SOAP UI Tool and I am able to receive the message but its not working thru my client program. SOAP meesage is correct but something is wrong somewhere. Please let me know where I am missing or what wrong I am doing??????