Passing parameters to WSDL
Author: satheesh.balu.m@gmail.com (Satheesh)
Hello
I have imported a wsdl file and it is available in signature.
I am trying to activate the using the service local name.
The wsdl expecting some input parameters andit will retrun the output to me.
I have the input params in variables. How can I pass the values?
Should I need to create a DTD? if yed how can I use it to pass the values?
Thanks
Satheesh.B
10 Comments
Local Administrator
Hi
Do like any other component, passing arguments. It depends on the web service signature, and how it was imported.
If it need one input parameter and one output parameter (as in document/literal wrapped ones), you've to create by yourself the XML document in a variable, and passing to (or retrieving from). With Uniface 9.5, structs are of great help to quickly create and parse know XML documents.
Kind regards,
Richard
Author: richard.gill (richard.gill@agfa.com)
Local Administrator
Hi,
Three examples without very much checking etc.
The result of the webservice-operation is returned in $status.
activate "MYWEBSERVICE".GetStatusOfInvoice(ID)
myStatus=$status
Importing (/sti) the easy flat structure, Uniface understands to build a data-model with an entity for you. Calling the webservice-operation the entity INVOICEENTITY is automatically populated into the entity of the form/service.
activate "MYWEBSERVICE".GetInvoice("INVOICEENTITY", ID)
;Just build code to do something with the Uniface INVOICEENTITY.
Importing (/sti) the complex structure can't be modelled by Uniface. Do whatever you want with the SoapResponse. If you use Uniface 9.5 use a struct.
activate "MYWEBSERVICE".GetComplexInvoice(SoapResponse, ID)
xmlToStruct mystruct, soapResponse
;traverse mystruct (technically fast, logically slow)
Regards RogerW
Author: rogerw (roger.wallin@abilita.fi)
Local Administrator
Hello Roger and Richard
Thanks for your reply. I am using a xmlstream (variable arg0) to pass the value. When I check in debug mode, after xmlsave statement, the variable holding the data which I am passing in the xml format, like below:
"<arg0>
<anzahlung>3000</anzahlung>
<beitragsart>B8</beitragsart>
<effektiverJahreszins>3.99</effektiverJahreszins>
<erstzulassung>28.02.1998</erstzulassung>
<fahrzeugtyp>PKW</fahrzeugtyp>
<geburtsdatum>15.05.1980</geburtsdatum>
<kappung>1</kappung>
<laufzeit>36</laufzeit>
<monatlicheRate>419.56</monatlicheRate>
<monatlicheRateZuschlaege>0 </monatlicheRateZuschlaege>
<produktListe>RSV1</produktListe>
<produktkombinationen>T</produktkombinationen>
<rabatt>2000</rabatt>
<tarifKennzeichen>1</tarifKennzeichen>
<tarifierungsdatum>01.07.2012</tarifierungsdatum>
<upe>349900</upe>
<zielrate>18144.50</zielrate>
</arg0>
"
But after activating the signature by passing the xmlstream as a parameter, the variable arg0 contains the below information. How to solve this?
"<?xml version="1.0" encoding="UTF-8"?>
<ufnc:parameter xmlns:ufnc="urn:uniface:applic:complexparameter">
<tarifierungsfehlerListe xmlns="">
<fehlerCode xmlns="">MANDFIELD</fehlerCode>
<fehlerText xmlns="">Für die gewählten Produkte [] ist eine Angabe erforderlich: Produktliste.</fehlerText>
<fehlerattributListe xmlns="">
<fehlergrenze xmlns=""/>
<fehlerparameter xmlns="">Produktliste</fehlerparameter>
<fehlerwert xmlns=""/>
</fehlerattributListe>
</tarifierungsfehlerListe>
<tarifierungsfehlerListe xmlns="">
<fehlerCode xmlns="">MANDFIELD</fehlerCode>
<fehlerText xmlns="">Für die gewählten Produkte [] ist eine Angabe erforderlich: TarifKennzeichen.</fehlerText>
<fehlerattributListe xmlns="">
<fehlergrenze xmlns=""/>
<fehlerparameter xmlns="">TarifKennzeichen</fehlerparameter>
<fehlerwert xmlns=""/>
</fehlerattributListe>
</tarifierungsfehlerListe>
<tarifierungsfehlerListe xmlns="">
<fehlerCode xmlns="">MANDFIELD</fehlerCode>
<fehlerText xmlns="">Für die gewählten Produkte [] ist eine Angabe erforderlich: Laufzeit.</fehlerText>
<fehlerattributListe xmlns="">
<fehlergrenze xmlns=""/>
<fehlerparameter xmlns="">Laufzeit</fehlerparameter>
<fehlerwert xmlns=""/>
</fehlerattributListe>
</tarifierungsfehlerListe>
Thanks
Satheesh.B
Author: Satheesh (satheesh.balu.m@gmail.com)
Local Administrator
may be you violated the casedependend way to write the XML tags?
In the return-List you see: Laufzeit, Produktliste, Tarifkennzeichen
In your XML there are: laufzeit, produktListe, tarifkennzeichen
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Hello Merkel,
I tried with the samecase. But still it producing the same error.
I am using the below code.
activate "ServiceName".OperationName(arg1, return_value)
I have created the DTD for arg1 and passing the value. But I couldn't able to create the enity/Fields(elements) for return_value in the same DTD.
Because, some of the element names are same between arg1 and return_value (both are entities). I am getting validation error.
Should I need to include the return_Value also in the DTD? if yes, how can I use the same element name for both input (Arg1) and output (return_value)
Thanks
Satheesh.B
Author: Satheesh (satheesh.balu.m@gmail.com)
Local Administrator
Hi,
if you don't use Uniface 9.5, I would recommend you to go there before trying to handle web-services. I remember that we had big problems with passing xml to a web-service as Uniface added a lot of stuff. On the other hand you will probably get some similar problems in Uniface 9.5, but then you have better chances to do some workaround by eg. structures.
In your case you have a flat occurence (or entity) so why not declare the parameters (in web-service signature) as occurence or entity (if you need many occurences) and let Uniface handle the parameter-problems by just using the name of the entity. Of course you then have to paint the entity in your Uniface form/service.
Regards RogerW.
Author: rogerw (roger.wallin@abilita.fi)
Local Administrator
is it possible your signature has "return in first argument" enabled?
then just your arguments need to be reordered to (return_value, arg1)
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Hello Ulrich,
Thanks a lot for your great help. It is working finally.
As per the signature, the return should be passed first. So passing outputparam, inputparam gives me the result.
Thanks again.
Regards
Satheesh.B
Author: Satheesh (satheesh.balu.m@gmail.com)
Local Administrator
Thanks to Ulrich, Mike, Roger, Richard...
Thanks all for helping me.
Regards
Satheesh.B
Author: Satheesh (satheesh.balu.m@gmail.com)
Local Administrator
Hi
Please can you link the WSDL/XSDs you are trying to use. The problem seems to be with the xml being used to call the service and without the definitions it is hard to know what is going wrong.
Regards,
Mike
Author: Mike Taylor (michael.taylor@uniface.com)