Coldfusion 9 webservice error

357 views Asked by At

I am trying to run a webservice using coldfusion. I can run the wsdl in the browser fine. When I try to run it via coldfusion I get:

Unable to parse WSDL as an XML document. 

Parsing error: Fatal Error: URI=null Line=-1: Premature end of file. 
It is recommended that you use a web browser to retrieve and examine the requested WSDL document to ensure it is correct.   

I have tried multiple methods:

wsargs.login='******';
wsargs.password='******';
ws = CreateObject("webservice", "https://correcturl.com/dswsbobje/qaawsservices/biws?WSDL=1&cuid-******", wsargs); 
req = getSOAPRequest(ws); 
</cfscript> 
<cfdump var="#req#">


<cfset wsargs = structNew()>
<cfset wsargs["login"]="******">
<cfset wsargs["password"]="******">
<cfinvoke webservice="https://correcturl.com/dswsbobje/qaawsservices/biws?WSDL=1&cuid=******" 
method="runQueryAsAService" 
returnvariable="results"
argumentCollection="#wsargs#">
</cfinvoke> 


<cfinvoke webservice="https://correcturl.com/dswsbobje/qaawsservices/biws?WSDL=1&cuid=******" 
method="runQueryAsAService" 
returnvariable="results">
<cfinvokeargument name="login" value="******"/> 
<cfinvokeargument name="password" value="******"/> 
</cfinvoke> 

But all give me this error. I have see other related errors and have tried the solutions in them, such as clearing out the Application.cfc/cfm and adding refreshwsdl='true' to the cfinvoke, none of which have done anything. Can anyone help me with this?

Thanks.

1

There are 1 answers

0
Lauren Robinson On

I guess I didnt have a full understanding of how this works. The url I was trying to use was to what I guess was the wsdl definition. I ran url an via wizdler ran the method. That then gave me a soap request that I then saved in a cfcsave content tag. My final code that worked looks like:

<cfset strURL = "https://correcturl.com/dswsbobje/qaawsservices/biws?WSDL=1&cuid=******">
<cfsavecontent variable="strXML">
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Header>
    <QaaWSHeader xmlns="VendorInfo">
        <sessionID>[string?]</sessionID>
        <serializedSession>[string?]</serializedSession>
        <ClientType>[string?]</ClientType>
        <AuditingObjectID>[string?]</AuditingObjectID>
        <AuditingObjectName>[string?]</AuditingObjectName>
    </QaaWSHeader>
</Header>
<Body>
    <runQueryAsAService xmlns="VendorInfoLR">
    <login>******</login>
<password>******</password>
    </runQueryAsAService>
</Body>
</Envelope>
</cfsavecontent>

<cfhttp url="#strURL#" method="post" useragent="#CGI.http_user_agent#" result="objGet">
<cfhttpparam type="XML" value="#strXML.Trim()#" />
</cfhttp>

Idea from :http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Q_24311762.html

This soap stuff is new to me, and I have more research to do to fully understand it. :)