[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTPAPI - Problem consuming WCF web service - HTTP/1.1 400 Bad Request



Thanks Thomas for the suggestion.  But I still get the Bad Request Error.

Kevin



                                                                                                                                                
                      Thomas Raddatz                                                                                                            
                      <thomas.raddatz@xxxxxxxxxx        To:       HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>                   
                      e>                                cc:                                                                                     
                      Sent by:                          Subject:  Re: HTTPAPI - Problem consuming WCF web service - HTTP/1.1 400    Bad         
                      ftpapi-bounces@xxxxxxxxxxx         Request                                                                                
                      klement.com                                                                                                               
                                                                                                                                                
                                                                                                                                                
                      09/13/2010 03:02 PM                                                                                                       
                      Please respond to HTTPAPI                                                                                                 
                      and FTPAPI Projects                                                                                                       
                                                                                                                                                
                                                                                                                                                




Unfortunately I cannot use soapUI to generate a sample message because
some imported schema files are missing. Most likely the following schema
file defines the "getData" element because it is associated to the same
namespace as the "tns:getData" element:

    <xsd:import

schemaLocation="
http://745kmiller/SafeActivationAPI/SafeActivation.svc?xsd=xsd0";

      namespace="http://tempuri.org/"/>

So it seems that you assigned the wrong namespace value to the "tns"
namespace prefix. As far as I can see the wsdl file assigns
"http://tempuri.org/"; to the "tns" namespace prefix which is used to
qualify the "getData" element:


  <wsdl:definitions ...
     xmlns:tns="http://tempuri.org/";  ...


  <wsdl:message name="ISafeActivationService_GetData_InputMessage">
    <wsdl:part name="parameters" element="tns:GetData"/>
  </wsdl:message>

So perhaps it is worth to change your request XML message like this:

     SOAP =
       '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
     +'<SOAP:Envelope'
     +'    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";'
     +'    xmlns:tns="http://tempuri.org/";>'
     +'<SOAP:Body>'
     +'<tns:GetData>'
     +'<tns:value>'+ %trim(int1) +'</tns:value>'
     +'</tns:GetData>'
     +'</SOAP:Body>'
     +'</SOAP:Envelope>';

Thomas


xmlns:tns="http://tempuri.org/";

Am 13.09.2010 21:23, schrieb kmiller@xxxxxxxxx:
>
> Thanks Scott and Thomas for the response.
>
> Thomas, I made the changes you suggested, and still received the error.
I
> am attaching the full wsdl file and the RPG code.  I couldn't create the
> wsdl with CR/LF, but other than that, it should be complete.
> I'm using my IP address instead of the server name, as that has worked
with
> all my other tests.
>
> Thanks for looking at this.
> (See attached file: SafeActivation.xml)(See attached file:
ConsumerRPG.txt)
>
>
>
>
>                        Thomas Raddatz
>                        <thomas.raddatz@xxxxxxxxxx        To:
HTTPAPI and FTPAPI Projects<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
>                        e>                                 cc:
>                        Sent by:                          Subject:  Re:
HTTPAPI - Problem consuming WCF web service - HTTP/1.1 400 Bad
>                        ftpapi-bounces@xxxxxxxxxxx         Request
>                        klement.com
>
>
>                        09/13/2010 01:12 PM
>                        Please respond to HTTPAPI
>                        and FTPAPI Projects
>
>
>
>
>
>
> Maybe that I am wrong or that I have over looked something but on my
> opinion you did not specify enough information to analyze the problem. I
am
>
> missing:
>
> a) the "tns:GetData" element as defined in the<types>  section of the
wsdl
> file.
>
> b) the namespace value that is associated to the "tns" namespace prefix
>
>
> So far the only things that seem to be clear are:
>
> a) the soap action value that you specified at http_url_post_xml()
>
> b) the different host that you used at http_url_post_xml()
>
>
> Nevertheless here are some potential errors with your xml request:
>
> a) '<SOAP  :Body>' should be'<SOAP:Body>'
>
> b)<SOAP:Envelope'
>      '    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";'
>      '    xmlns:tns="http://tempuri.org/ISafeActivationService/";'
>
>      should be
>
>      <SOAP:Envelope'
>      '    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";'
>      '    xmlns:tns="http://tempuri.org/ISafeActivationService/";>'
>
>
> The proper request should look like this one:
>
>     SOAP =
>       '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
>     +'<SOAP:Envelope'
>     +'    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";'
>     +'    xmlns:tns="http://tempuri.org/ISafeActivationService/";>'
>     +'<SOAP:Body>'
>     +'<tns:GetData>'
>     +'<tns:value>'+ %trim(int1) +'</tns:value>'
>     +'</tns:GetData>'
>     +'</SOAP:Body>'
>     +'</SOAP:Envelope>';
>
>
> Thomas.
>
> Am 13.09.2010 14:53, schrieb kmiller@xxxxxxxxx:
>>
>> I wrote a basic web service and was able to consume it fine.  Then I
> wrote
>> a WCF web service (Same basic code) and when I tryied to consume it,
>> received the following error:
>>
>> HTTP/1.1 400 Bad Request
>>
>> I have attached the RPG code, the SVC file, and the error log.  Can
> someone
>> take a quick look to see if I have this set-up properly?  Thanks!!
>>
>> Here is the relevent RPG code:
>>
>> SOAP =
>>    '<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
>> +'<SOAP:Envelope'
>> +'    xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";'
>> +'    xmlns:tns="http://tempuri.org/ISafeActivationService/";'
>> +'<SOAP  :Body>'
>> +'<tns:GetData>'
>> +'<tns:value>'+ %trim(int1) +'</tns:value>'
>> +'</tns:GetData>'
>> +'</SOAP:Body>'
>> +'</SOAP:Envelope>';
>>
>> http_debug(*ON);
>>
>> rc = http_url_post_xml(
>>     'http://172.20.20.99/SafeActivationAPI/SafeActivation.svc/basic'
>>                     : %addr(SOAP) + 2
>>                     : %len(SOAP)
>>                     : *NULL
>>                     : %paddr(Incoming)
>>                     : %addr(String)
>>                     : HTTP_TIMEOUT
>>                     : HTTP_USERAGENT
>>                     : 'text/xml; charset=utf-8'
>>                     :
> 'http://tempuri.org/ISafeActivationService/GetData');
>>
>>
>> Here is the relevent xml from the SVC file:
>>
>> <wsdl:message name="ISafeActivationService_GetData_InputMessage">
>>              <wsdl:part name="parameters" element="tns:GetData" />
>>          </wsdl:message>
>>         -<wsdl:message name
> ="ISafeActivationService_GetData_OutputMessage">
>>              <wsdl:part name="parameters" element="tns:GetDataResponse"
/>
>>          </wsdl:message>
>>         -<wsdl:message name="
>>         ISafeActivationService_GetDataUsingDataContract_InputMessage">
>>              <wsdl:part name="parameters" element="
>>           tns:GetDataUsingDataContract" />
>>          </wsdl:message>
>>         -<wsdl:message name="
>>         ISafeActivationService_GetDataUsingDataContract_OutputMessage">
>>              <wsdl:part name="parameters" element="
>>           tns:GetDataUsingDataContractResponse" />
>>          </wsdl:message>
>>         -<wsdl:portType name="ISafeActivationService">
>>           -<wsdl:operation name="GetData">
>>                <wsdl:input wsaw:Action="
>>             http://tempuri.org/ISafeActivationService/GetData"; message="
>>             tns:ISafeActivationService_GetData_InputMessage" />
>>                <wsdl:output wsaw:Action="
>>             http://tempuri.org/ISafeActivationService/GetDataResponse";
>>             message="tns:ISafeActivationService_GetData_OutputMessage"
/>
>>            </wsdl:operation>
>>           -<wsdl:operation name="GetDataUsingDataContract">
>>                <wsdl:input wsaw:Action="
>>
> http://tempuri.org/ISafeActivationService/GetDataUsingDataContract
>>             " message="
>>
> tns:ISafeActivationService_GetDataUsingDataContract_InputMessage"
>>             />
>>                <wsdl:output wsaw:Action="
>>
>
http://tempuri.org/ISafeActivationService/GetDataUsingDataContractResponse
>>             " message="
>>
> tns:ISafeActivationService_GetDataUsingDataContract_OutputMessage
>>             " />
>>            </wsdl:operation>
>>          </wsdl:portType>
>>         -<wsdl:binding name="WSHttpBinding_ISafeActivationService" type
="
>>         tns:ISafeActivationService">
>>              <wsp:PolicyReference URI="
>>           #WSHttpBinding_ISafeActivationService_policy" />
>>              <soap12:binding transport="
> http://schemas.xmlsoap.org/soap/http";
>>           />
>>           -<wsdl:operation name="GetData">
>>                <soap12:operation soapAction="
>>             http://tempuri.org/ISafeActivationService/GetData"; style="
>>             document" />
>>             -<wsdl:input>
>>                  <wsp:PolicyReference URI="
>>
#WSHttpBinding_ISafeActivationService_GetData_Input_policy"
> />
>>                  <soap12:body use="literal" />
>>              </wsdl:input>
>>             -<wsdl:output>
>>                  <wsp:PolicyReference URI="
>>
#WSHttpBinding_ISafeActivationService_GetData_output_policy"
> />
>>                  <soap12:body use="literal" />
>>              </wsdl:output>
>>            </wsdl:operation>
>>           -<wsdl:operation name="GetDataUsingDataContract">
>>                <soap12:operation soapAction="
>>
> http://tempuri.org/ISafeActivationService/GetDataUsingDataContract
>>             " style="document" />
>>             -<wsdl:input>
>>                  <wsp:PolicyReference URI="
>>
>
#WSHttpBinding_ISafeActivationService_GetDataUsingDataContract_Input_policy
>>               " />
>>                  <soap12:body use="literal" />
>>              </wsdl:input>
>>             -<wsdl:output>
>>                  <wsp:PolicyReference URI="
>>
>
#WSHttpBinding_ISafeActivationService_GetDataUsingDataContract_output_policy

>
>>               " />
>>                  <soap12:body use="literal" />
>>              </wsdl:output>
>>            </wsdl:operation>
>>          </wsdl:binding>
>>         -<wsdl:binding name="BasicHttpBinding_ISafeActivationService"
type
> ="
>>         tns:ISafeActivationService">
>>              <soap:binding transport="
http://schemas.xmlsoap.org/soap/http
> " />
>>           -<wsdl:operation name="GetData">
>>                <soap:operation soapAction="
>>             http://tempuri.org/ISafeActivationService/GetData"; style="
>>             document" />
>>             -<wsdl:input>
>>                  <soap:body use="literal" />
>>              </wsdl:input>
>>             -<wsdl:output>
>>                  <soap:body use="literal" />
>>              </wsdl:output>
>>            </wsdl:operation>
>>           -<wsdl:operation name="GetDataUsingDataContract">
>>                <soap:operation soapAction="
>>
> http://tempuri.org/ISafeActivationService/GetDataUsingDataContract
>>             " style="document" />
>>             -<wsdl:input>
>>                  <soap:body use="literal" />
>>              </wsdl:input>
>>             +<wsdl:output>
>>                  <soap:body use="literal" />
>>              </wsdl:output>
>>            </wsdl:operation>
>>          </wsdl:binding>
>>         -<wsdl:service name="SafeActivationService">
>>           -<wsdl:port name="WSHttpBinding_ISafeActivationService"
binding
> ="
>>           tns:WSHttpBinding_ISafeActivationService">
>>                <soap12:address location="
>>             http://745kmiller/SafeActivationAPI/SafeActivation.svc"; />
>>             -<wsa10:EndpointReference>
>>                  <wsa10:Address>
>>               http://745kmiller/SafeActivationAPI/SafeActivation.svc</
>>               wsa10:Address>
>>               -<Identity xmlns="
>>               http://schemas.xmlsoap.org/ws/2006/02/addressingidentity";>
>>                    <Dns>localhost</Dns>
>>                </Identity>
>>              </wsa10:EndpointReference>
>>            </wsdl:port>
>>           -<wsdl:port name="BasicHttpBinding_ISafeActivationService"
> binding
>>           ="tns:BasicHttpBinding_ISafeActivationService">
>>                <soap:address location="
>>             http://745kmiller/SafeActivationAPI/SafeActivation.svc/basic
"
> />
>>            </wsdl:port>
>>          </wsdl:service>
>>        </wsdl:definitions>
>>
>>
>> Here is the log output
>>
>> HTTPAPI Ver 1.23 released 2008-04-24
>> OS/400 Ver V5R4M0
>>
>> New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
>> http_persist_open(): entered
>> http_long_ParseURL(): entered
>> DNS resolver retrans: 2
>> DNS resolver retry  : 2
>> DNS resolver options: x'00000136'
>> DNS default domain: PRI.COM
>> DNS server found: 172.20.20.93
>> http_persist_post(): entered
>> http_long_ParseURL(): entered
>> do_post(): entered
>> POST /SafeActivationAPI/SafeActivation.svc/basic HTTP/1.1
>> Host: 172.20.20.99
>> User-Agent: http-api/1.23
>> Content-Type: text/xml; charset=utf-8
>> SOAPAction: http://tempuri.org/ISafeActivationService/GetData
>> Expect: 100-continue
>> Content-Length: 291
>>
>>
>> recvresp(): entered
>> HTTP/1.1 100 Continue
>> Server: Microsoft-IIS/5.1
>> Date: Fri, 10 Sep 2010 19:33:10 GMT
>> X-Powered-By: ASP.NET
>>
>>
>> SetError() #13: HTTP/1.1 100 Continue
>> senddoc(): entered
>> <?xml version="1.0" encoding="iso-8859-1" standalone
="no"?><SOAP:Envelope
>> xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/";    xmlns:tns="
>> http://tempuri.org/ISafeActivationService/";<SOAP  :Body>
<tns:GetData>
>> <tns:value>7</tns:value>    </tns:GetData></SOAP:Body></SOAP:Envelope>
>> recvresp(): entered
>> HTTP/1.1 400 Bad Request
>> Server: Microsoft-IIS/5.1
>> Date: Fri, 10 Sep 2010 19:33:10 GMT
>> X-Powered-By: ASP.NET
>> X-AspNet-Version: 2.0.50727
>> Cache-Control: private
>> Content-Length: 0
>>
>>
>> SetError() #13: HTTP/1.1 400 Bad Request
>> recvdoc parms: identity 0
>> header_load_cookies() entered
>> recvdoc(): entered
>> SetError() #0:
>> SetError() #13: HTTP/1.1 400 Bad Request
>> http_close(): entered
>>
>>
>>
>>
>>
>>
>> -----------------------------------------------------------------------
>> This is the FTPAPI mailing list.  To unsubscribe, please go to:
>> http://www.scottklement.com/mailman/listinfo/ftpapi
>> -----------------------------------------------------------------------
>>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>
>
>
>
>
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------





-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------