[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Webservice - Inputparameter
Hello Scott and Mike
Thank you very much for your answers. What content-type would be better?
I tried to change the parameter to _P0XMLINPUT. I received an
error-message because of the '_'.
The debug file is:
HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V6R1M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_url_post(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: WEMAG.ch
DNS server found: 195.186.1.110
http_persist_post(): entered
http_persist_req(POST) entered.
http_long_ParseURL(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /web/services/KIS14TRA HTTP/1.1
Host: chwemag1:10010
User-Agent: http-api/1.24
Content-Type: text/xml; charset=UTF-8
SOAPAction: urn.kis14tra
Content-Length: 370
senddoc(): entered
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://kis14tra.wsbeans.iseries/xsd"> <soapenv:Header/>
<soapenv:Body> <xsd:kis14tra> <xsd:args0>
<xsd:P0XMLINPUT>iinnppuuttXmL07 </xsd:P0XMLINPUT> </xsd:args0>
</xsd:kis14tra> </soapenv:Body></soapenv:Envelope>
recvresp(): entered
HTTP/1.1 200 OK
Date: Mon, 09 Sep 2013 08:13:07 GMT
Server: Lotus Expeditor Web Container/6.1
Content-Length: 308
Connection: close
Content-Type: text/xml; charset=UTF-8
Content-Language: de-CH
SetError() #13: HTTP/1.1 200 OK
recvresp(): end with 200
recvdoc parms: identity 308
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:kis14traResponse
xmlns:ns="http://kis14tra.wsbeans.iseries/xsd"><ns:return><ns:_P0RESULTAT></ns:_P0RESULTAT></ns:return></ns:kis14traResponse></soapenv:Body></soapenv:Envelope>
http_close(): entered
The result of the web-service is:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:kis14traResponse
xmlns:ns="http://kis14tra.wsbeans.iseries/xsd"><ns:return><ns:_P0RESULTAT></ns:_P0RESULTAT></ns:return></ns:kis14traResponse></soapenv:Body></soapenv:Envelope>
I have another webservice Kis14 running in production for almost a year
now. It works like a charm and gets called 30'000+ times a day:
The wsdl is:
<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:ns="http://kis14.wsbeans.iseries/xsd"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://kis14.wsbeans.iseries"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns1="http://org.apache.axis2/xsd"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://kis14.wsbeans.iseries">
<wsdl:types>
<xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://kis14.wsbeans.iseries/xsd">
<xs:element name="kis14_XML">
<xs:complexType>
<xs:sequence>
<xs:element name="args0" type="ns:KIS14Input"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="KIS14Input">
<xs:sequence>
<xs:element name="_P0ANZAHL" type="xs:string"/>
<xs:element name="_P0AUSFUEHRUNG" type="xs:string"/>
<xs:element name="_P0EXTARTNR" type="xs:string"/>
<xs:element name="_P0EXTKDNR" type="xs:string"/>
<xs:element name="_P0FARBE" type="xs:string"/>
<xs:element name="_P0FIRMA" type="xs:string"/>
<xs:element name="_P0LTCODE" type="xs:string"/>
<xs:element name="_P0RESULTAT" type="xs:string"/>
<xs:element name="_P0VERKAUFSSTELLE" type="xs:string"/>
<xs:element name="_P0WERK" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="kis14_XMLResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="kis14">
<xs:complexType>
<xs:sequence>
<xs:element name="args0" type="ns:KIS14Input"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="kis14Response">
<xs:complexType>
<xs:sequence>
<xs:element name="return" type="ns:KIS14Result"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="KIS14Result">
<xs:sequence>
<xs:element name="_P0RESULTAT" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="kis14_XMLRequest">
<wsdl:part name="parameters" element="ns:kis14_XML"/>
</wsdl:message>
<wsdl:message name="kis14_XMLResponse">
<wsdl:part name="parameters" element="ns:kis14_XMLResponse"/>
</wsdl:message>
<wsdl:message name="kis14Request">
<wsdl:part name="parameters" element="ns:kis14"/>
</wsdl:message>
<wsdl:message name="kis14Response">
<wsdl:part name="parameters" element="ns:kis14Response"/>
</wsdl:message>
<wsdl:portType name="KIS14PortType">
<wsdl:operation name="kis14_XML">
<wsdl:input message="tns:kis14_XMLRequest" wsaw:Action="urn:kis14_XML"/>
<wsdl:output message="tns:kis14_XMLResponse"
wsaw:Action="urn:kis14_XMLResponse"/>
</wsdl:operation>
<wsdl:operation name="kis14">
<wsdl:input message="tns:kis14Request" wsaw:Action="urn:kis14"/>
<wsdl:output message="tns:kis14Response" wsaw:Action="urn:kis14Response"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="KIS14Soap11Binding" type="tns:KIS14PortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<wsdl:operation name="kis14_XML">
<soap:operation soapAction="urn:kis14_XML" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="kis14">
<soap:operation soapAction="urn:kis14" 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="KIS14">
<wsdl:port name="KIS14HttpSoap11Endpoint" binding="tns:KIS14Soap11Binding">
<soap:address location="http://CHWEMAG1.WEMAG.ch:8080/web/services/KIS14"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The procedure-interface of the program, that gets started by the service is:
d kis14 PI
d p0Firma 2a const
d p0ExtKdNr 6a const
d p0ExtArtNr 8a const
d p0Farbe 6a const
d p0Ausfuehrung 6a const
d p0Verkaufsstelle...
d 2a const
d p0Werk 3a const
d p0LTCode 1a const
d p0Anzahl 7a const
d p0Resultat 32765a
I call the service like this:
SOAP= '<soapenv:Envelope xmlns:soapenv='
+ '"http://schemas.xmlsoap.org/soap/envelope/"'
+ ' xmlns:xsd="http://kis14.wsbeans.iseries/xsd">'
+ ' <soapenv:Header/>'
+ ' <soapenv:Body>'
+ ' <xsd:kis14>'
+ ' <xsd:args0>'
+ ' <xsd:p0ANZAHL>' + '4 ' + '</xsd:p0ANZAHL>'
+ ' <xsd:p0AUSFUEHRUNG>' + ' '
+ ' </xsd:p0AUSFUEHRUNG>'
+ ' <xsd:p0EXTARTNR>' + '00051226'
+ ' </xsd:p0EXTARTNR>'
+ ' <xsd:p0EXTKDNR>' + ' ' + '</xsd:p0EXTKDNR>'
+ ' <xsd:p0FARBE>' + ' ' + '</xsd:p0FARBE>'
+ ' <xsd:p0FIRMA>' + ' ' + '</xsd:p0FIRMA>'
+ ' <xsd:p0LTCODE>' + ' ' + '</xsd:p0LTCODE>'
+ ' <xsd:p0VERKAUFSSTELLE>' + ' '
+ ' </xsd:p0VERKAUFSSTELLE>'
+ ' <xsd:p0WERK>' + ' ' + '</xsd:p0WERK>'
+ ' </xsd:args0>'
+ ' </xsd:kis14>'
+ ' </soapenv:Body>'
+ '</soapenv:Envelope>';
len = %len(SOAP);
msg = 'len *' + %char(len) + '*';
dsply msg;
// http_setCCSIDs(1208 : 0); **************
http_debug(*ON: '/jgvtmp/kis14Debug.txt');
rc = http_post('http://chwemag1:10010/web/services/KIS14'
: %addr(SOAP) + VARYINGDATAOFFSET
: %len(SOAP)
: '/jgvtmp/kis14encUtf24.xml'
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml; charset=UTF-8'
: 'urn.kis14');
I've tried to make a “copy” of Kis14 and call the copy Kis14Tra, but I
still can't find the reason, why it won't work.
Thank you very much in advance.
Best regards
Jan
Am 06.09.2013 21:07, schrieb Scott Klement:
I would also take a look at the content-type. I doubt very much that
text/xml is the correct content type for a SOAP web service....
On 9/6/2013 11:14 AM, Mike Krebs wrote:
A idea for you to look at...
The WSDL file you included doesn't look like WSDL to me but rather I
think of it as an example. And as such, the parameters shown should
be used as shown. The _P0XMLINPUT element should be called that in
the SOAP message in HTTPAPI (no _ and small letter p in the HTTPAPI
side). Capitalization for many services will not matter; for some it
will. It depends on the parsers involved and I don't know enough
about the IWS to know which parser IBM used.
XML is forgiving about missing parameters so skipping the _P0RESULTAT
is acceptable but we do not know if it is required or optional for
your web service. If the above doesn't help, try adding the
_P0RESULTAT element.
Does the debug show that the web service runs fine? What is the
result that you get back from the web service?
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Jan Grove
Vejlstrup
Sent: Friday, September 06, 2013 9:32 AM
To: HTTPAPI and FTPAPI Projects
Subject: Webservice - Inputparameter
Hello,
I'm using the integrated Web Service of the IBM i to create a
webservice: the WSDL-file is:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://kis14tra.wsbeans.iseries/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:kis14tra>
<xsd:args0>
<xsd:_P0RESULTAT>?</xsd:_P0RESULTAT>
<xsd:_P0XMLINPUT>?</xsd:_P0XMLINPUT>
</xsd:args0>
</xsd:kis14tra>
</soapenv:Body>
</soapenv:Envelope>
The part of the program, that gets started by the webservice and that
should receive the input-parameter is:
d kis14tra PR ExtPgm('KIS14TRA')
d Resultat 32765a
d xmlInput 32765a const
d kis14tra PI
d p0Resultat 32765a
d p0xmlInput 32765a const
d HEX15 c x'15'
d msg s 52a varying
d string s 32760a varying
d stringWithOutHex15...
d s 32760a varying
d stringWithOutHex15Utf8...
d s 32760a varying
d pointer s *
d buffLen s 10u 0
d buffer s 32760a based(pointer)
d stringEnc s 32760a
d enclen s 10i 0
D from ds likeds(QtqCode_T)
D inz(*LIKEDS)
D to ds likeds(QtqCode_T)
D inz(*LIKEDS)
D table ds likeds(iconv_t)
D p_input s *
D inleft s 10U 0
D p_output s *
D outleft s 10U 0
D len s 10U 0
D errMsg s 50A
D input_data2 s 32760A varying
D output_data2 s 32760A varying
d cmd s 1024a varying
d fehlerText s 1000a varying
d firma s 2a
d extKdNrAlfa s 6a
d LTCode s 1a
d verkaufsStelle...
d s 2a
d werk s 3a
d AnzDetPos s 10i 0
d transportKosten...
d s 15p 2
/free
*inlr = *on;
cmd = 'call bshop/gisaliba';
qcmdexc(cmd: %len(cmd));
msg = 'Hier kommt die lib-list2';
dsply msg;
cmd = 'dsplibl output(*print)';
qcmdexc(cmd: %len(cmd));
msg = 'xmlInput01*' + %trim(p0XmlInput) + '*';
dsply msg;
My test-program looks like:
H DFTACTGRP(*NO) actgrp(*new) bnddir('HTTPAPI')
H copyright('(c) 2013 WEMAG Consulting AG, CH-3122 Kehrsatz')
W*E CRTBNDRPG kis143i srcfile(*libl/qrpglesrc)
W*E+ DBGVIEW(*SOURCE)
W*E+ REPLACE(*YES)
E*W
*
/copy HTTPAPI_H
*
*
d kis143i PR ExtPgm('KIS143I')
d kis143i PI
d VARYINGDATAOFFSET...
d c const(2)
d msg s 52a varying
d SOAP s 1024a varying
d rc s 10i 0
d len s 10i 0
/free
SOAP= '<soapenv:Envelope xmlns:soapenv='
+ '"http://schemas.xmlsoap.org/soap/envelope/"'
+ ' xmlns:xsd="http://kis14tra.wsbeans.iseries/xsd">'
+ ' <soapenv:Header/>'
+ ' <soapenv:Body>'
+ ' <xsd:kis14tra>'
+ ' <xsd:args0>'
+ ' <xsd:p0XMLINPUT>' + 'inputXXMMLL4 '
+ ' </xsd:p0XMLINPUT>'
+ ' </xsd:args0>'
+ ' </xsd:kis14tra>'
+ ' </soapenv:Body>'
+ '</soapenv:Envelope>';
len = %len(SOAP);
msg = 'len *' + %char(len) + '*';
dsply msg;
// http_setCCSIDs(1208 : 0); **************
http_debug(*ON: '/jgvtmp/kis14Debug.txt');
rc = http_post('http://chwemag1:10010/web/services/KIS14TRA'
: %addr(SOAP) + VARYINGDATAOFFSET
: %len(SOAP)
: '/jgvtmp/kis14encUtf40.xml'
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml; charset=UTF-8'
: 'urn.kis14tra');
if (rc <> 1);
http_crash();
endif;
*inlr = *on;
/end-free
My problem is, that the program, that is startet by the webservice,
don't receive the input-parameter. The dsply results in "xmlInput01**" .
The input parameter should be inputXXMMLL4, but is empty. I cannot find
the reason for that. What am I doing wrong?
I'm on 6.1 and using HTTPAPI 1.24.
Best regards
Jan
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------