8 Replies Latest reply: Feb 19, 2012 8:23 PM by 917005 RSS

    The HTTP request did not contain a valid SOAPAction header with apache http

    917693
      I am invoking a opportunity service , but ending with the following Error.
      SOAP Response:

      <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Client</faultstring><detail><ErrorCode>SBL-ODU-01007</ErrorCode><ErrorMessage>The HTTP request did not contain a valid SOAPAction header.  The value of the header was document/urn:crmondemand/ws/ecbs/opportunity/10/2004:OpportunityQueryPage</ErrorMessage></detail></soap:Fault></soap:Body></soap:Envelope>

      i am using apache http client to invoke this service.

      SOAP Request Msg:

      <?xml version=\"1.0\" encoding=\"UTF-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns=\"urn:crmondemand/ws/ecbs/opportunity/10/2004\" xmlns:quer=\"urn:/crmondemand/xml/Opportunity/Query\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2002/07/secext\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> <soapenv:Header><wsse:Security><wsse:UsernameToken><wsse:Username>XXXXXX</wsse:Username><wsse:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">XXXXXXX</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><ns:OpportunityQueryPage_Input><quer:ListOfOpportunity pagesize=\"100\" startrownum=\"1\" recordcountneeded=\"5\"><quer:Opportunity searchspec=\"[Owner] LIKE '*'\"><quer:Description sortorder=\"ASCE\"></quer:Description><quer:AccountName sortorder=\"ASCE\"></quer:AccountName><quer:cActual_Booking_ValueTCV_Mn></quer:cActual_Booking_ValueTCV_Mn></quer:Opportunity></quer:ListOfOpportunity></ns:OpportunityQueryPage_Input></soapenv:Body></soapenv:Envelope>


      My Invocation URL:
      https://secure-ausomxapa.crmondemand.com/Services/Integration

      i am not able to find exactly where is the error. Kindly Help to fix this issue.

      Thanks in advance.

      Thanks and Regards,
      Balaji Varaprasad.G
        • 1. Re: The HTTP request did not contain a valid SOAPAction header with apache http
          917005
          I had the same problem, instead I'm invoking the "CustomRecordType" service. Following is my request and response:
          Request
          <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cus="urn:crmondemand/ws/odesabs/customrecordtype/" xmlns:data="urn:/crmondemand/xml/customrecordtype/data">
          <SOAP-ENV:Header>
          <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <wsse:UsernameToken>
          <wsse:Username>xxxx</wsse:Username>
          <wsse:Password>xxxx</wsse:Password>
          </wsse:UsernameToken>
          </wsse:Security>
          </SOAP-ENV:Header>
          <SOAP-ENV:Body>
          <cus:CustomRecordTypeUpsert_Input>
          <data:CustomRecordType>
          <!--You may enter the following 6 items in any order-->
          <data:Name>myname</data:Name>
          <!--Optional:-->
          <data:SingularName>myname</data:SingularName>
          <!--Optional:-->
          <data:PluralName>myname</data:PluralName>
          <!--Optional:-->
          <data:ShortName>myname</data:ShortName>
          <!--Optional:-->
          <data:IconName>myname</data:IconName>
          <data:ListOfCustomRecordTypeTranslations>
          <!--1 or more repetitions:-->
          <data:CustomRecordTypeTranslation>
          <!--You may enter the following 4 items in any order-->
          <data:LanguageCode>?</data:LanguageCode>
          <data:SingularName>?</data:SingularName>
          <data:PluralName>?</data:PluralName>
          <data:ShortName>?</data:ShortName>
          </data:CustomRecordTypeTranslation>
          </data:ListOfCustomRecordTypeTranslations>
          </data:CustomRecordType>
          </cus:CustomRecordTypeUpsert_Input>
          </SOAP-ENV:Body>
          </SOAP-ENV:Envelope>

          Response
          <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          <soap:Body>
          <soap:Fault>
          <faultcode>soap:Client</faultcode>
          <faultstring>Client</faultstring>
          <detail>
          <ErrorCode>SBL-ODU-01007</ErrorCode>
          <ErrorMessage>The HTTP request did not contain a valid SOAPAction header. The value of the header was "document/urn:crmondemand/ws/odesabs/CustomRecordType/:CustomRecordTypeUpsert"</ErrorMessage>
          </detail>
          </soap:Fault>
          </soap:Body>
          </soap:Envelope>

          My invoke URL: https://secure-ausomxapa.crmondemand.com/Services/Integration

          Seems that we need include the SOAPAction header in the request, but I don't know how to. Anyone can help? Thanks in advance!
          • 2. Re: The HTTP request did not contain a valid SOAPAction header with apache http
            Charles Dubant[eFrontech]
            Dear Balaji,

            There are several mistakes in your call for Opportunity Webservices so please compare by yourself with the working version below :

            <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="urn:crmondemand/ws/ecbs/opportunity/10/2004" xmlns:quer="urn:/crmondemand/xml/Opportunity/Query" xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <soapenv:Header>
                 <ns1:Security>
                      <ns1:UsernameToken>
                      <ns1:Username>LOGIN</ns1:Username>
                      <ns1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</ns1:Password>
                      </ns1:UsernameToken>
                 </ns1:Security>
            </soapenv:Header>
            <soapenv:Body>
            <ns:OpportunityQueryPage_Input>
            <quer:ListOfOpportunity pagesize="100" startrownum="0" recordcountneeded="true">
                      <quer:Opportunity searchspec="">
                           <!-- Project ID -->
                           <quer:Id sortorder="" sortsequence=""></quer:Id>
                           <!-- Project Name -->
                           <quer:OpportunityName sortorder="" sortsequence=""></quer:OpportunityName>
                           <!-- Project Type -->
                           <quer:OpportunityType sortorder="" sortsequence=""></quer:OpportunityType>
                      </quer:Opportunity>
            </quer:ListOfOpportunity>
            </ns:OpportunityQueryPage_Input>
            </soapenv:Body>
            </soapenv:Envelope>


            Best regards,
            Charles.
            • 3. Re: The HTTP request did not contain a valid SOAPAction header with apache http
              Charles Dubant[eFrontech]
              I already answered to you and gave you the solution, having a quick look at what you posted, I can see immediately that for example, your "wsse" is never defined at the beginning of your file.

              Please have a look at my previous answer in this thread to try with a working solution for Opportunities and then move on to other objects once you have fully understood the syntax and behaviour.

              Good luck,
              Best regards,
              Charles.
              • 4. Re: The HTTP request did not contain a valid SOAPAction header with apache http
                917693
                Dear Charles,
                The SOAP message i have posted earlier was working with SOAP UI tool, and i am able to get the response messages. but it is not working with the Apache HTTPClient api to invoke this service. I have gone through the SOAP message which you have sent in earlier post, even i this(username and password changed) is also not working, getting same ERROR.
                If you could able to check this with the java code please try from your end ,if it is working or not...

                Java Code Here:

                String content= "Please Paste the SOAP Request Message";
                String url="https://secure-ausomxapa.crmondemand.com/Services/Integration";
                String action="document/urn:crmondemand/ws/ecbs/opportunity/10/2004:OpportunityQueryPage";

                HttpClient client = new HttpClient();
                          PostMethod post;
                          System.out.println((new StringBuilder(" content :")).append(content).toString());
                          System.out.println((new StringBuilder(" action :")).append(action).toString());
                          System.out.println((new StringBuilder(" url :")).append(url).toString());
                          DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(     1, false);
                          client.getParams().setParameter(HttpClientParams.RETRY_HANDLER,     retryHandler);
                          post = new PostMethod(url);
                          post.setDoAuthentication(true);
                          post.setContentChunked(true);
                          StringRequestEntity sre = new StringRequestEntity(content, "text/xml","UTF-8");
                          post.setRequestHeader("SOAPAction", action);
                          post.setRequestHeader("User-Agent", "Axis2");
                          post.setRequestEntity(sre);
                          try {
                               String s;
                               int status = client.executeMethod(post);
                               String response = post.getResponseBodyAsString();
                               System.out.println(status);
                               System.out.println(post.getStatusCode());
                               System.out.println(post.getStatusText());
                          System.out.println(response);
                               System.out.println(post.isRequestSent());
                               s = response.substring(response.indexOf("<"));
                               // post.releaseConnection();
                               return s;
                          } catch (Exception ex) {
                ex.printStackTrace();
                               
                               return "<MESSAGE><BODY><EXCEPTION>" + ex.getMessage()
                                         + "</EXCEPTION></BODY></MESSAGE>";

                          }

                Please help to fix this..

                Thanks and Regards,
                Balaji Varaprasad.G
                • 5. Re: The HTTP request did not contain a valid SOAPAction header with apache http
                  917693
                  If you can send any Java code to invoke this web service(without generating stub classes) and corresponing request message for oppertunity Query page would be great help to us.

                  Thanks and Regards,
                  Balaji Varaprasad.G
                  • 6. Re: The HTTP request did not contain a valid SOAPAction header with apache http
                    917005
                    Yes, thank you for the reply and it did solve the wsse security issue, thanks again! But I met another issue after that, as I stated in this thread.
                    For the CustomRecordType service, which url location should I use?
                    1) https://secure-ausomxapa.crmondemand.com/Services/cte/CustomRecordTypeService
                    or
                    2) https://secure-ausomxapa.crmondemand.com/Services/Integration
                    ?
                    Using 1) I'll get "Internal Server Error (unexpected null value for literal data)" error; using 2) I'll get "The HTTP request did not contain a valid SOAPAction header" error.
                    • 7. Re: The HTTP request did not contain a valid SOAPAction header with apache http
                      Charles Dubant[eFrontech]
                      Dear,

                      In case (and it seems so) you are using "Customize Record Type" in "Administrative Services", you should use the proposed default which is "https://secure-ausomxapa.crmondemand.com/Services/cte/CustomRecordTypeService".

                      But there is absolutely no reason to change it to something else.

                      It should eventually look like (in SOAP), where you have replaced the <soapenv:Header> section by the one I already gave you, and declared your namespace (ns1 which is a xmlns = xml namespace) for logging in the soapenv:Envelope :

                      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="urn:crmondemand/ws/odesabs/customrecordtype/" xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                      <soapenv:Header>
                           <ns1:Security>
                                <ns1:UsernameToken>
                                <ns1:Username>USERNAME</ns1:Username>
                                <ns1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">PASSWORD</ns1:Password>
                                </ns1:UsernameToken>
                           </ns1:Security>
                      </soapenv:Header>
                      <soapenv:Body>
                      <cus:CustomRecordTypeReadAll_Input>
                      <cus:IncludeAll></cus:IncludeAll>
                      </cus:CustomRecordTypeReadAll_Input>
                      </soapenv:Body>
                      </soapenv:Envelope>
                      • 8. Re: The HTTP request did not contain a valid SOAPAction header with apache http
                        917005
                        Hi Charles, thank you very much! By using your soap request, I can invoke the CustomRecordTypeReadAll service successfully!!!
                        But for CustomRecordTypeUpsert, STILL have following error response:
                        <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
                        <env:Header/>
                        <env:Body>
                        <env:Fault>
                        <faultcode>env:VersionMismatch</faultcode>
                        <faultstring>Version Mismatch</faultstring>
                        <faultactor>http://schemas.xmlsoap.org/soap/actor/next</faultactor>
                        </env:Fault>
                        </env:Body>
                        </env:Envelope>

                        Following is my request:
                        <SOAP-ENV:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="urn:crmondemand/ws/odesabs/customrecordtype/" xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                        <soapenv:Header>
                        <ns1:Security>
                        <ns1:UsernameToken>
                        <ns1:Username>Username</ns1:Username>
                        <ns1:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Password</ns1:Password>
                        </ns1:UsernameToken>
                        </ns1:Security>
                        </soapenv:Header>
                        <SOAP-ENV:Body>
                        <cus:CustomRecordTypeUpsert_Input>
                        <data:CustomRecordType>
                        <!--You may enter the following 6 items in any order-->
                        <data:Name>myname</data:Name>
                        <!--Optional:-->
                        <data:SingularName>myname</data:SingularName>
                        <!--Optional:-->
                        <data:PluralName>myname</data:PluralName>
                        <!--Optional:-->
                        <data:ShortName>myname</data:ShortName>
                        <!--Optional:-->
                        <data:IconName>myname</data:IconName>
                        <data:ListOfCustomRecordTypeTranslations>
                        <!--1 or more repetitions:-->
                        <data:CustomRecordTypeTranslation>
                        <!--You may enter the following 4 items in any order-->
                        <data:LanguageCode>a</data:LanguageCode>
                        <data:SingularName>a</data:SingularName>
                        <data:PluralName>a</data:PluralName>
                        <data:ShortName>a</data:ShortName>
                        </data:CustomRecordTypeTranslation>
                        </data:ListOfCustomRecordTypeTranslations>
                        </data:CustomRecordType>
                        </cus:CustomRecordTypeUpsert_Input>
                        </SOAP-ENV:Body>
                        </SOAP-ENV:Envelope>