[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



Just as an FYI,

If you have WDSC6 or 7, or RDI-SOA (I don't think RDPi includes any web development stuff) you can use it to get the appropriate xml to send with HTTPAPI.

Import the WSDL, into a project, for the service, I have a project just for imported WSDLs.
Right-click on the imported WSDL and select Web Services -> Test with Web Service Explorer.
This will start the explorer in your browser, you'll have a list of services on the left, and two panels on the right.
You can modify the endpoint to the appropriate URL if you need to.
Select the service on the left, the top right pane will have the parameters, in a form, that need to be filled in. Click on Source in the upper right corner and it will display the xml that would be sent for that service request.
Copy-Paste and replace the filled in parameters with the appropriate code. Send with HTTPAPI.

Duane Christen

--


                Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx

Visit PAETEC.COM


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas Raddatz
Sent: Monday, September 13, 2010 5:15 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: HTTPAPI - Problem consuming WCF web service - HTTP/1.1 400 Bad Request

You downloaded the wrong package. Please go to "http://sourceforge.net/projects/soapui/";, click on "View all files" and download "soapui-3.6-windows-bin.zip".

I did not yet download that file but installed v2.5.1 a long time ago. I guess that 3.6 also contains a .bat file to lunch soapUI.

Good luck.

Thomas.

Am 13.09.2010 22:20, schrieb kmiller@xxxxxxxxx:
>
> Thanks Scott.  I've been trying to install SoapUI all day today.  I've
> tried to install it on two different machines.  I get the same error
> on both computers:
>
> A Virtual Machine Launcher window has the following error:
> Failed to load Main-Class manifest attribute from
> [path]maven-soapui-plugin-2.5.1[1].jar
>
> So I have posted this issue on their forum and am waiting for a response.
> Do you know of any other free wsdl programs?
>
>
>
>
>
>
>                        Scott Klement
>                        <sk@xxxxxxxxxxxxxxxx>              To:       HTTPAPI and FTPAPI Projects<ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
>                        Sent by:                          cc:
>                        ftpapi-bounces@xxxxxxxxxxx        Subject:  Re: HTTPAPI - Problem consuming WCF web service - HTTP/1.1 400    Bad
>                        klement.com                        Request
>
>
>                        09/13/2010 02:55 PM
>                        Please respond to HTTPAPI
>                        and FTPAPI Projects
>
>
>
>
>
>
> Hello,
>
> Your SafeActivation.xml file makes the following references:
>
> <xsd:schema targetNamespace="http://tempuri.org/Imports";>
> <xsd:import
> schemaLocation="
> http://745kmiller/SafeActivationAPI/SafeActivation.svc?xsd=xsd0";
> namespace="http://tempuri.org/"/>
> <xsd:import
> schemaLocation="
> http://745kmiller/SafeActivationAPI/SafeActivation.svc?xsd=xsd1";
> namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
> <xsd:import
> schemaLocation="
> http://745kmiller/SafeActivationAPI/SafeActivation.svc?xsd=xsd2";
> namespace="
> http://schemas.datacontract.org/2004/07/SafeActivationServiceLibrary"/
> >
> </xsd:schema>
>
> As you can see... not all of the definitions are in the XML you sent.
> It needs to connect to http://745kmiller to get further documents.
> Since http://745kmiller doesn't seem to exist on the public Internet,
> I can't take this any further.  However, you can attempt to do it yourself...
>
> Please load this WSDL file into SoapUI yourself, and see if you can
> get the web service to work through SoapUI.  If you can, then please
> check the XML generated by SoapUI against what you have in your RPG program.
> Also check the SoapAction the same way.
>
> If you don't have a copy of SoapUI, you can get it here (get the open
> source, free version):
> http://www.soapui.org/
>
> Thanks
>
>
>
>
> On 9/13/2010 2:23 PM, kmiller@xxxxxxxxx wrote:
>>
>> 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/GetDataUsingDataContractResp
> onse
>>>              " 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_p
> olicy
>>>                " />
>>>                   <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
> -----------------------------------------------------------------------
>
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------