Orbeon sending instance data to a web service - web-services

I created an instance for the web service call and response.
<xf:instance id="ws-request-instance">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.estat.zzi.si/">
<soapenv:Header/>
<soapenv:Body>
<ws:orbeonGet>
<dokumentId/>
<type/>
<formData/>
</ws:orbeonGet>
</soapenv:Body>
</soapenv:Envelope>
</xf:instance>
<xf:instance id="ws-response-instance">
<soapenv:Envelope>
</soapenv:Envelope>
</xf:instance>
The submit function calls the created service like this:
<xf:submission id="submit" action="http://was7test.zzi.si:8081/EStat-RO-WS-91-XX/orbeon" method="post" ref="instance('ws-request-instance')" replace="instance" mediatype="application/soap+xml" instance="ws-response-instance">
<xf:message ev:event="xforms-submit-done" level="modal">Done Result:<xf:output value="instance('ws-response-instance')"/>
<xf:output value="event('error-type')"/>; Status: <xf:output value="event('response-status-code')"/>; URI: <xf:output value="event('resource-uri')"/>; Headers: <xf:output value="event('response-headers')"/>; Body: <xf:output value="event('response-body')"/>
</xf:message>
<xf:message ev:event="xforms-submit-error" level="modal">
A submission error occurred: <xf:output value="event('error-type')"/>; Status: <xf:output value="event('response-status-code')"/>; URI: <xf:output value="event('resource-uri')"/>; Headers: <xf:output value="event('response-headers')"/>; Body: <xf:output value="event('response-body')"/>
</xf:message>
</xf:submission>
When the submit button is clicked we fill in the parameters to the web service call like this:
<xf:action ev:event="submit-form">
<xf:setvalue ref="instance('ws-request-instance')//type" value="xxf:get-request-parameter('type')"/>
<xf:setvalue ref="instance('ws-request-instance')//dokumentId" value="xxf:get-request-parameter('documentId')"/>
<xf:setvalue ref="instance('ws-request-instance')//formData" value="instance('fr-form-instance')"/>
<xf:send submission="submit"/>
</xf:action>
In the formData parameter I would like to get the "XML" data of the fr-form-instance. For example, the instance is "X", and I am only getting X, not the whole "instance" in XML.
Is this even posible? Can you please guide me to the right direction?

Found out how ;) I just used "saxon" and wrote:
<xf:setvalue
ref="instance('ws-request-instance-get')//formData"
value="saxon:serialize(instance('fr-form-instance'), 'xml')"/>

Related

Importing the wsdl file in postman

I am trying to access the client URL web service in postman. I used the import link to import the wsdl file client URL in postman and successfully generated the collection. However, upon testing the request, I am unable to retrieve the data from the client server. I am only getting an empty element in the response body. I followed some of the SOAP Web Service tutorial on youtube and it is still the same. The client provided me the valid username for me to test but still the same.
This is my request body:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<zhi_sa_mgt xmlns="urn:mss:jfnllns:df">
<P_DATE>2022-10-22</P_DATE>
<P_NAME>
<item>HPOITY</item>
</P_NAME>
</zhi_sa_mgt>
</soap:Body>
</soap:Envelope>
And the response body:
<?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>
<zhi_sa_mgt xmlns="urn:mss:jfnllns:df">
<P_DATA/>
</zhi_sa_mgt>
</soap:Body>
</soap:Envelope>
I just wanted to ask, what could be the possible reason/s on why I am getting the empty tag <P_DATA>? This is my first SOAP web service task and I cannot figure out why I cant retrieve the data from the client server. Thank you in advance for your response.

Salesforce soap error: not a valid value for the enum 'ExecutionLogType'

Can anyone help me with this? I can't find information anywhere about this error message.
I created a webservice class and i'm using SoapUI just to check if it's working and I keep getting the error below.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>'' is not a valid value for the enum 'ExecutionLogType'</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
My input is below. I I don't know how to use the field Client or why it's generated in the wsdl, this field is not in my class.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:exec="http://soap.sforce.com/schemas/class/ExecutiveCareWebservice">
<soapenv:Header>
<exec:AllowFieldTruncationHeader>
<exec:allowFieldTruncation>FALSE</exec:allowFieldTruncation>
</exec:AllowFieldTruncationHeader>
<exec:DebuggingHeader>
<exec:categories>
<exec:category>ALL</exec:category>
<exec:level>DEBUG</exec:level>
</exec:categories>
<exec:debugLevel></exec:debugLevel>
</exec:DebuggingHeader>
<exec:CallOptions>
<exec:client>1</exec:client>
</exec:CallOptions>
<exec:SessionHeader>
<exec:sessionId>00D0E0000008dby!ASAAQBqFFnoPgI88ekHhKy4.N0aKNAw5sIR_1LSGSqzZ_cOg.4oH9hpyW1cB2JDC._BnMKu54FhiJ4p_ORUyIQf39MbRZoqs</exec:sessionId>
</exec:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<exec:getActiveClientes>
<exec:validationDate></exec:validationDate>
</exec:getActiveClientes>
</soapenv:Body>
</soapenv:Envelope>
Thanks in advance!
Joana
Simplify your soapenv:Header headers. I suspect the problem is with the exec:DebuggingHeader header. In particular, the exec:debugLevel is likely related to the ExecutionLogType.
Just leave that header out completely. In fact, the only header you should need is exec:SessionHeader

How do I remove operation element from soap envelope body in WCF?

I have a WCF service setup mostly to a customer's spec, yet there is one extra element required of an envelope body that I'm trying to exclude based on the customer's sample request.
These are my service and operation contracts:
[ServiceContract(Namespace="http://www.somenamespace.com")]
public interface IProcessPayment
{
[OperationContract]
ResponseSubmitPayment execute(RequestSubmitPayment RequestSubmitPayment);
}
This is what they are sending to test my service with:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pay="http://www.somenamespace.com">
<soapenv:Header/>
<soapenv:Body>
<pay:RequestSubmitPayment>
<!-- irrelevant stuff -->
</pay:RequestSubmitPayment>
</soapenv:Body>
</soapenv:Envelope>
and this is what my service expects (based on SOAPUI):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pay="http://www.somenamespace.com">
<soapenv:Header/>
<soapenv:Body>
<pay:execute> <!-- I want to remove this! -->
<pay:RequestSubmitPayment>
<!-- irrelevant stuff -->
</pay:RequestSubmitPayment>
</pay:execute> <!-- I want to remove this! -->
</soapenv:Body>
</soapenv:Envelope>
How can I configure my WCF service to not require or exclude that element? The client has told me they have many other customers with it successfully tested and implemented. SOAP 1.1 is my understanding of what they're sending.
Thanks in advance!
Not sure it is doable in operationcontract. Try using a message contract, it will give you the flexibility you need. If that fails use an xmlserializer contract with method flag ParameterStyle = SoapParameterStyle.Bare.

How to call a webservice method for testing, e.g. from a browser

There is a dll webservice (made with Delphi) that has a method called List which returns a list of strings (widestring).
Is there any method for calling that service without having to write a client application for consuming it?.
Ex.: http://misitio.com:8080/miwebservice.dll?methodname=list
The Chrome App Postman can send SOAP requests. You just need to provide the Web Service URL, select POST, set the proper content-type header (text/xml, application/soap+xml, etc.), and provide the proper xml soap body in the request. Click Send.
Below is an example request which posts to a free weather web service.
Your request could be something like:
POST /WeatherWS/Weather.asmx/GetCityWeatherByZIP HTTP/1.1
Host: wsf.cdyne.com
Cache-Control: no-cache
Postman-Token: e5bc46a4-71ac-f357-78a7-c4b4de894afb
Content-Type: application/x-www-form-urlencoded
ZIP=90210
And the response will be:
<?xml version="1.0" encoding="utf-8"?>
<WeatherReturn xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://ws.cdyne.com/WeatherWS/">
<Success>true</Success>
<ResponseText>City Found</ResponseText>
<State>CA</State>
<City>Beverly Hills</City>
<WeatherStationCity>Van Nuys</WeatherStationCity>
<WeatherID>4</WeatherID>
<Description>Sunny</Description>
<Temperature>68</Temperature>
<RelativeHumidity>54</RelativeHumidity>
<Wind>CALM</Wind>
<Pressure>29.89R</Pressure>
<Visibility />
<WindChill />
<Remarks />
</WeatherReturn>

How to change the way coldfusion send the soap response?

I have a coldfusion webservice which takes in XML data and send back the acknowledgement.
When there is an error the current code returns me the soap response as
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:updatePendingTicketsResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://v02.intouchdataservice">
<updatePendingTicketsReturn xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><![CDATA[<fault>
<faultcode>TO BE DEFINED IF NEEDED</faultcode>
<faultstring >Content is not allowed in prolog.</faultstring>
<faultactor>InTouch</faultactor>
</fault>]]></updatePendingTicketsReturn>
</ns1:updatePendingTicketsResponse>
</soapenv:Body>
</soapenv:Envelope>
But what I would like to have in response is
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>TO BE DEFINED IF NEEDED</faultcode>
<faultstring >Content is not allowed in prolog.</faultstring>
<faultactor>InTouch</faultactor>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Is there a way we can change the way coldfusion sends back the response when there is an exception?
In addition to that, Is there a way we can add an XML schema to the coldfusion WSDL to validate the XML document thats been send ?
Thank you
I think no but you can put whole code in try and catch define your own response code.
You can use the wsdlfile attribute of <cfcomponent /> to specify a custom WSDL.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7e0e.html
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78a6.html