Lucee Webservice SOAP (style document-literal)
Description
Attachments
- 22 Dec 2019, 07:07 pm
- 22 Dec 2019, 06:30 pm
- 07 Feb 2019, 03:17 pm
- 07 Feb 2019, 03:15 pm
Activity
Michael Offner 21 May 2024 at 19:58
this part of the project is deprecated and only get security fixes, sorry.
David R. 22 December 2019 at 19:07
Hi @Pothys - MitrahSoft … just a little follow up, the below screenshot is from my oxygen Editor, testing the same webservice of previous message
David R. 22 December 2019 at 18:30
Hi @Pothys - MitrahSoft following your suggest I made another test.
I expose a cfc webservice with component setting to “remote” and returntype as “struct”
As you can see, after the webservice call, I receive the XML as a string, encapsulaed to Envelop/Body structure.
Afters this, I have to Parse the XML string to have the XML structure.
Please, confirm that this is the only way to have the XML messages exchange from caller and Lucee.
Below the code of my test
<!--- wsComponentOnlyOneFunction.cfc --->
<cfcomponent
displayname="TestComponentName"
output="no"
remote="true"
returntype="struct">
<!--- //
Comonent returntype : must be struct
// --->
<cfsavecontent variable="xmlDocument">
<cfoutput><?xml version="1.0" encoding="UTF-8"?>
<Success>
<Token>
<TokenString>12345678901234567890</TokenString>
<TokenDeadLine>2020-03-20</TokenDeadLine>
</Token>
<Information>
<Notes>Lucee Request/Response Webservices</Notes>
<Terms>Testing schema</Terms>
</Information>
</Success></cfoutput>
</cfsavecontent>
<cffunction
name="myHelloXml"
displayname="xmlTestFunction"
access="remote"
returntype="string"
output="no">
<cfargument name="example" type="numeric" default="0" hint="" required="true">
<cfset xmlReturn = xmlParse(xmlDocument)>
<cfreturn xmlReturn>
</cffunction>
</cfcomponent>
the Call
<cfscript>
GwsURL = 'http://my.porta80.it/ws/wsComponentOnlyOneFunction.cfc?wsdl';
Gws = webserviceNew( GwsURL );
GResponseWS = Gws.myHelloXml(example='120');
writeOutput('Webesrvice ' & '<br>');
writeDump ( Gws );
writeOutput('Resposnse ' & '<br>');
writeDump ( GResponseWS );
MyXML = GResponseWS;
MyXMLParsed = xmlParse(MyXML);
writeOutput('Parsed Response ' & '<br>');
writeDump ( MyXMLParsed );
//GresXMLParsed = xmlParse(XmlText);
writeOutput('TokenString: ' & MyXMLParsed.Success.Token.TokenString & '<br>');
writeOutput('TokenDeadLine: ' & MyXMLParsed.Success.Token.TokenDeadLine & '<br>');
writeOutput('Soap Complete Response ' & '<br>');
GrespSOAPWs = GetSOAPResponse( Gws );
writeDump ( GrespSOAPWs);
</cfscript>
As you can see, the Soap Complete Response, show the XML String encapsulated into the Envelope structure.
See below. Is there another way to get XML message as a real structure?
Thanks a lot
Davide
David R. 28 November 2019 at 12:50
I get this problem again to solve it. I follow your guide but I stille have problem to expose the soap webservice to the world.
I’m using Insomia or Oxygen Client to the my webservice.
The wsdl now is here : http://my.porta80.it/ws/wsComponent.cfc?wsdl
When I call the webservice always I have a fault response.
Below are my code:
wsComponent.cfc
<cfcomponent
namespace="http://nsContech"
style="rpc"
<!--- style="document" not supported --->
>
<cffunction name="myHelloXml" access="remote" returntype="string" output="no"><!--- returnformat ="plain" produces="application/xml"--->
<cfargument name="example" type="numeric" default="0" hint="" required="true">
<cfsavecontent variable="x">
<details>
<Call>abc</Call>
<Value>X</Value>
</details>
</cfsavecontent>
<!--- <cfset x = xmlParse(x)> --->
<!--- <cfcontent type="application/xml; charset=UTF-8"> --->
<!--- <cfset MyXML.Envelope.Body.ValoreSoap.XmlText = ChiamataSOAP> --->
<cfreturn trim(x)>
</cffunction>
</cfcomponent>
My XML Request (from Insomnia Client)
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<ws:myHelloXml SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<example>10.50</example>
</ws:myHelloXml>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
My XML Reponse from Lucee
<?xml version="1.0" encoding="UTF-8"?>
<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:myHelloXmlResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://ws">
<myHelloXmlReturn xsi:type="xsd:string"><details>
<Call>abc</Call>
<Value>X</Value>
</details></myHelloXmlReturn>
</ns1:myHelloXmlResponse>
</soapenv:Body>
</soapenv:Envelope>
I don’t find any <cffunction
parameters that can solve this.
I noticed that if I omit the cfcomponent namespace option , system response as below
“No body returned for response”
If I add to the cfcomponent the option returntype="struct" the result is the same
Please help if you can, I need to translate many Soap webservice from CF to Lucee but I don’t find a solution.
Thanks a lot.
Davide
Pothys - MitrahSoft 12 February 2019 at 15:47
Hi @David R.,
I've checked it in ACF 9,10,11 & lucee 5.2,5.3 latest. All of them return the same error.
For webservice, Its not possible to use cfinvoke to call the methods in cfc. Better use createObject like '<cfset obj=createObject("webservice", wsURL) >' Error will not occur as you mentioned. Please refer LDEV-346. After fixing this issue only we can use one more method as remote.
If you comment any one of the methods in the component & test page that calls it & Change the return type='struct' in the component it works.
@Michael Offner will decide about this issue.
Details
Assignee
Michael OffnerMichael OffnerReporter
David R.David R.Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Priority
Trivial
Details
Details
Assignee
Reporter
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Hi all, We are working to migrate some soap webservice from CFMX8 (old and fashion coldfusion
) ) to Lucee.
After some test I found that the CFC don't support the document-literal style, so I ask to you when this will be available.
So, for the moment, can you suggest me how can enable those webservice using Lucee?
Thanks a lot
Davide