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

RE: HTTPAPI Related Problem



It often occurs that some web services reject a request if the HTTP header does not arrive with the correct SoapAction attribute.
It may be that your HTTPAPI request is sending an empty SoapAction header. The doco about the webservice should stipulate the required value for SoapAction.

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chuck Boegel
Sent: Friday, 5 February 2010 4:22 a.m.
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: HTTPAPI Related Problem

First, let me say I'm new to using HTTPAPI and I have limited (but good) experience with using XML.  I know we do have HTTPAPI working in another application for communications with UPS, so the product (installed in
2008) is functioning well.
 
I'm trying to communicate with a Webservice using HTTPAPI.  I can use the Webservice itself to communicate the XML data stream, but I can't seem to do it from an RPG program or from soapUI.
 
If I plug this XML data (see below) into the Webservice at https://shop.aafes.com/val/MilStarVendor.asmx?op=MSApproval  , it will come back with a valid response.
 
<?xml version="1.0" encoding="utf-8" ?><MSApproval xmlns="MSApproval"><Request ID="XX000001"><CCNumber>1111222233334444</CCNumber><Amount>100</Amount>
<FacNbr>99999999</FacNbr><Region>T</Region></Request></MSApproval>
 
Response:
<?xml version="1.0" encoding="utf-8" ?>
  <string xmlns="http://thor.aafes.com/val/MilStarVendor.asmx";><?xml
version="1.0" encoding="utf-8"?><MSApproval><Request
ID="99999999"><CCNumber>1111222233334444</CCNumber><Amount>000000100</Am
ount><FacNbr>99999999</FacNbr><Region>T</Region></Request><Response><Ret
urnCode>X</ReturnCode><AuthCode></AuthCode><AuthTkt></AuthTkt><ReturnMes
sage>Internal Error: Invalid Facility
Number</ReturnMessage></Response></MSApproval></string> 
 
 
If I plug the same data (field WK_XML) into my RPG program using
HTTPAPI:
 
http_setCCSIDs(1208: 0);                                    
http_debug(*ON);                                            
RC = HTTP_URL_POST(                                         
'https://shop.aafes.com/val/MilStarVendor.asmx':            
%addr(WK_XML):%len(%trimr(WK_XML)):%trim(WK_FILE):30:'':'': 
'https://shop.aafes.com/val/MilStarVendor.asmx?op=MSApproval');
 
It comes back with the following error in the httpapi_debug.txt file:
 
SetError() #13: HTTP/1.1 500 Internal Server Error.
recvdoc parms: identity 874
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction:
https://thor.aafes.com/val/MilStarVendor.asmx?op=MSApproval.
at
System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean&amp; abortProcessing)</faultstring> <detail /> </soap:Fault> </soap:Body> </soap:Envelope>
SetError() #13: HTTP/1.1 500 Internal Server Error.
http_close(): entered
 
 
If I setup  https://shop.aafes.com/val/MilStarVendor.asmx?wsdl  in soapUI 3.0.1 and plug in the same data:
 
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:mil="http://thor.aafes.com/val/MilStarVendor.asmx
<http://thor.aafes.com/val/MilStarVendor.asmx> ">
   <soapenv:Header/>
   <soapenv:Body>
      <mil:MSApproval>
         <!--Optional:-->
         <mil:inXMLApproval><?xml version="1.0" encoding="utf-8"
?><MSApproval xmlns="MSApproval"><Request ID="XX000001"><CCNumber>1111222233334444</CCNumber><Amount>100</Amount>
<FacNbr>99999999</FacNbr><Region>T</Region></Request></MSApproval></mil:
inXMLApproval>
      </mil:MSApproval>
   </soapenv:Body>
</soapenv:Envelope>  
 
It comes back with the following response:
 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>System.Web.Services.Protocols.SoapException:
Server was unable to read request. --->
System.InvalidOperationException: There is an error in XML document (6, 11). ---> System.Xml.XmlException: The XML declaration is unexpected.
Line 6, position 31.
   at System.Xml.XmlTextReader.ParseTag()
   at System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities()
   at System.Xml.XmlTextReader.Read()
   at System.Xml.XmlReader.ReadElementString()
   at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Re
ad2_MSApproval()
   at
Microsoft.Xml.Serialization.GeneratedAssembly.MSApprovalSerializer.Deser
ialize(XmlSerializationReader reader)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader)
   at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
   at System.Web.Services.Protocols.WebServiceHandler.Invoke()
   at
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</fa
ultstring>
         <detail/>
      </soap:Fault>
   </soap:Body>
</soap:Envelope> 
 
Can anyone see the error of my ways?  Any help at all is much appreciated.  
     




CONFIDENTIALITY NOTICE: This electronic message transmission contains information from this organization, which may be confidential or privileged. The information is intended for the sole use of the individual or entity named above. If you are not the intended recipient, be aware that any disclosure, copying, distribution, or use of the contents of this information is prohibited. If you have received this email in error, please notify the sender immediately and delete the original message. Neither the sender nor the company for which he or she works accepts any liability for any damage caused by any virus transmitted by this email.

Visit our website www.vedaadvantage.com. It has a new design with improved navigation and search capabilities; and customer friendly interface with more relevant insights and solutions to help you make informed decisions.

#####################################################################################

This correspondence is for the named person's use only. It may contain confidential 
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose, 
copy or rely on any part of this correspondence if you are not the intended recipient. 
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda Advantage.
If you need assistance, please contact Veda Advantage on either :-
Australia 1300-921-621 or New Zealand +64 9 367 6200
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------