0 Replies Latest reply: Mar 2, 2012 12:23 AM by 791417 RSS

    SOAPException: faultCode=SOAP-ENV:Protocol; msg=Missing content type

    791417
      I have a WSDL file for which I have created a Web Service stub/skeleton through jdeveloper(version 10.1.2.3.0). Below is the complete code which has been generated by developer. Now whenever i try to run this file in jdeveloper I get the following exception. Please let me know how to resolve this issue.

      Also error message is received at the following line of code:
      *msg.send(endpointURL, ""<<some URL>>", requestEnv);*
      {code}
      __________________________________
      *Exception Message*
      {code}
      --------------------------------------------------------------------------------
      [SOAPException: faultCode=SOAP-ENV:Protocol; msg=Missing content type.]
      at org.apache.soap.transport.TransportMessage.read(TransportMessage.java:249)
      at oracle.soap.transport.http.OracleSOAPHTTPConnection.post(OracleSOAPHTTPConnection.java:973)
      at oracle.soap.transport.http.OracleSOAPHTTPConnection.send(OracleSOAPHTTPConnection.java:722)
      at org.apache.soap.messaging.Message.send(Message.java:125)
      at mypackage.NPVNSDLStub.PANDetails(NPVNSDLStub.java:88)
      at mypackage.NPVNSDLStub.main(NPVNSDLStub.java:41)
      {code}
      __________________________________
      *Code generated by Jdeveloper*
      {code}
      --------------------------------------------------------------------------------
      package mypackage;
      import oracle.soap.transport.http.OracleSOAPHTTPConnection;
      import org.apache.soap.encoding.SOAPMappingRegistry;
      import org.w3c.dom.Element;
      import java.util.Vector;
      import oracle.jdeveloper.webservices.runtime.WrappedDocLiteralStub;
      import java.net.URL;
      import org.apache.soap.Envelope;
      import org.apache.soap.Body;
      import org.apache.soap.messaging.Message;
      import java.util.Properties;
      /**
      * Generated by the Oracle JDeveloper 10g Web Services Stub/Skeleton Generator.
      * Date Created: Wed Feb 29 18:39:33 IST 2012
      * WSDL URL: file:/C:/WS/sample.wsdl
      */
      
      public class NPVNSDLStub extends WrappedDocLiteralStub 
      {
      public NPVNSDLStub()
      {
      m_httpConnection = new OracleSOAPHTTPConnection();
      }
      
      public static void main(String[] args)
      {
      try
      {
      NPVNSDLStub stub = new NPVNSDLStub();
      stub.PANDetails("aaaaa8888a");
      
      }
      catch(Exception ex)
      {
      ex.printStackTrace();
      }
      
      }
      
      private String _endpoint = "<<some URL>>";
      
      public String getEndpoint()
      {
      return _endpoint;
      }
      
      public void setEndpoint(String endpoint)
      {
      _endpoint = endpoint;
      }
      
      private OracleSOAPHTTPConnection m_httpConnection = null;
      private SOAPMappingRegistry m_smr = null;
      
      public String PANDetails(String Request) throws Exception
      {
      URL endpointURL = new URL(_endpoint);
      
      Envelope requestEnv = new Envelope();
      
      
      Body requestBody = new Body();
      Vector requestBodyEntries = new Vector();
      
      
      String wrappingName = "PANValidationRequest";
      String targetNamespace = "<<namespace url>>";
      Vector requestData = new Vector();
      requestData.add(new Object[] {"Request", Request});
      
      requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData, false));
      requestBody.setBodyEntries(requestBodyEntries);
      requestEnv.setBody(requestBody);
      
      Message msg = new Message();
      msg.setSOAPTransport(m_httpConnection);
      
      
      *msg.send(endpointURL, "<<some URL>>", requestEnv);*
      
      Envelope responseEnv = msg.receiveEnvelope();
      Body responseBody = responseEnv.getBody();
      Vector responseData = responseBody.getBodyEntries();
      
      return (String)fromElement((Element)responseData.elementAt(0), java.lang.String.class);
      }
      }
      {code}
      
      Edited by: EJP on 2/03/2012 17:22: added code tags, but your indentation needs fixing