Problem in Consuming a Java Web Service through COLDFUSION

Problem in Consuming a Java Web Service through COLDFUSION

Page 1 of 1

1 Replies - 13513 Views - Last Post: 26 August 2006 - 05:06 PM Rate Topic: -----

#1 sandyvohra  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-July 06

Problem in Consuming a Java Web Service through COLDFUSION

Posted 20 July 2006 - 10:57 PM

Hi All – We have a web service running on ARSystem ( Remedy) and all we would like to do is



-Invoke this web service from our Coldfusion page

-Send some parameters in a method call for ‘Remedy WS’

-This Webservice returns a simple String object.

The WSDL looks like this..

---------------------
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2"

xmlns="http://schemas.xmlsoap.org/wsdl/"

xmlns:s="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2"

xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <xsd:schema elementFormDefault="qualified"

targetNamespace="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2">
<xsd:element name="OpCreate" type="s:CreateInputMap" />
- <xsd:complexType name="CreateInputMap">
- <xsd:sequence>
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="Requester_Login_Name" type="xsd:string" />
<xsd:element name="Requester_Name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="OpCreateResponse" type="s:CreateOutputMap" />
- <xsd:complexType name="CreateOutputMap">
- <xsd:sequence>
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="Requester_Login_Name" type="xsd:string" />
<xsd:element name="Requester_Name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="AuthenticationInfo" type="s:AuthenticationInfo" />
- <xsd:complexType name="AuthenticationInfo">
- <xsd:sequence>
<xsd:element name="userName" type="xsd:string" />
<xsd:element name="password" type="xsd:string" />
<xsd:element minOccurs="0" name="authentication" type="xsd:string" />
<xsd:element minOccurs="0" name="locale" type="xsd:string" />
<xsd:element minOccurs="0" name="timeZone" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="OpCreateSoapOut">
<wsdl:part element="s:OpCreateResponse" name="parameters" />
</wsdl:message>
- <wsdl:message name="ARAuthenticate">
<wsdl:part element="s:AuthenticationInfo" name="parameters" />
</wsdl:message>
- <wsdl:message name="OpCreateSoapIn">
<wsdl:part element="s:OpCreate" name="parameters" />
</wsdl:message>
- <wsdl:portType name="CHG_Change_WebService_OpCreate_DisplayOnly_v2PortType">
- <wsdl:operation name="OpCreate">
<wsdl:input message="s:OpCreateSoapIn" />
<wsdl:output message="s:OpCreateSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="CHG_Change_WebService_OpCreate_DisplayOnly_v2SoapBinding"

type="s:CHG_Change_WebService_OpCreate_DisplayOnly_v2PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="OpCreate">
<soap:operation soapAction="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2/OpCreate"

style="document" />
- <wsdl:input>
<soap:header message="s:ARAuthenticate" part="parameters" use="literal" />
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="CHG_Change_WebService_OpCreate_DisplayOnly_v2Service">
- <wsdl:port binding="s:CHG_Change_WebService_OpCreate_DisplayOnly_v2SoapBinding"

name="CHG_Change_WebService_OpCreate_DisplayOnly_v2Soap">
<soap:address

location="http://oldtas184/arsys/services/ARService?server=OLDTAS184&webService=CHG_Change_W

ebService_OpCreate_DisplayOnly_v2" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
------------
My simple invocation to this Java Web Service on Remedy looks like this..

------------
<cfinvoke

webservice="http://oldtas184/arsys/WSDL/public/OLDTAS184/CHG_Change_WebService_OpCreate_Disp

layOnly_v2" method="opCreate" returnvariable="aString">
<cfinvokeargument name="Description" value="test"/>
<cfinvokeargument name="Requester_Login_Name" value="testLogin"/>
<cfinvokeargument name="Requester_Name" value="testRequester"/>
</cfinvoke>
<cfoutput>#aString#</cfoutput>
------------------

The Exception I am receiving is as follows and I am not sure if there is any SOAP Header

which we are missing or a Complex types creating issues in Java and Coldfusion problem.

Could not perform web service invocation "opCreate".
Here is the fault returned when invoking the web service operation:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString:
MessageType: 2
MessageNum: 8961
MessageText: Required element expected in the input XML document
AppendedText: <Description>
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:
MessageType: 2
MessageNum: 8961
MessageText: Required element expected in the input XML document
AppendedText: <Description>
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
at

org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at

org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unk

nown Source)
at org.apache.x...

PLEASE HELP ME AS ITS A DEADLINE FOR ME AND I AM ALREADY LATE IN DELIVERING THE WORKING

CODE.

Is This A Good Question/Topic? 0
  • +

Replies To: Problem in Consuming a Java Web Service through COLDFUSION

#2 sandyvohra  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-July 06

Re: Problem in Consuming a Java Web Service through COLDFUSION

Posted 26 August 2006 - 05:06 PM

Thanks Guys - Kinda thought of giving you an update on this problem. Well its definitely a bug or rather a compatibility issue with AR System and AXIS version we used to inoke this web service on the former.

But good thing is that for us we had a work around of using a Servlet/JAVA API to create entry in Remedy BUT we found this could be possible even through CFHTTP. I had tried using CFHTTP but missed a header name.. here's the code..I hope this will help..

Code below:
-----------------------------------------------------------------
<cfsavecontent variable="testwsSoapRequest">
<cfoutput>
<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>
<Test xmlns="urn:testwebservice">
<Assigned_To>Demo</Assigned_To>
<Short_Description>Testing SOAP Post via HTTP</Short_Description>
<Submitter>Demo</Submitter>
</Test>
</soapenv:Body>
</soapenv:Envelope>
</cfoutput>
</cfsavecontent>

<cfhttp url="http://<url to web service" method="post">

<cfhttpparam name="SOAPAction" type="HEADER"
value="urn:testwebservice"
<!--- send SOAP request in body --->
<cfhttpparam name="attachedDocument" type="body"
value="#testwsSoapRequest#">
</cfhttp>
----------------------------------------

View Postsandyvohra, on 20 Jul, 2006 - 10:57 PM, said:

Hi All – We have a web service running on ARSystem ( Remedy) and all we would like to do is



-Invoke this web service from our Coldfusion page

-Send some parameters in a method call for ‘Remedy WS’

-This Webservice returns a simple String object.

The WSDL looks like this..

---------------------
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2"

xmlns="http://schemas.xmlsoap.org/wsdl/"

xmlns:s="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2"

xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <xsd:schema elementFormDefault="qualified"

targetNamespace="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2">
<xsd:element name="OpCreate" type="s:CreateInputMap" />
- <xsd:complexType name="CreateInputMap">
- <xsd:sequence>
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="Requester_Login_Name" type="xsd:string" />
<xsd:element name="Requester_Name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="OpCreateResponse" type="s:CreateOutputMap" />
- <xsd:complexType name="CreateOutputMap">
- <xsd:sequence>
<xsd:element name="Description" type="xsd:string" />
<xsd:element name="Requester_Login_Name" type="xsd:string" />
<xsd:element name="Requester_Name" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="AuthenticationInfo" type="s:AuthenticationInfo" />
- <xsd:complexType name="AuthenticationInfo">
- <xsd:sequence>
<xsd:element name="userName" type="xsd:string" />
<xsd:element name="password" type="xsd:string" />
<xsd:element minOccurs="0" name="authentication" type="xsd:string" />
<xsd:element minOccurs="0" name="locale" type="xsd:string" />
<xsd:element minOccurs="0" name="timeZone" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="OpCreateSoapOut">
<wsdl:part element="s:OpCreateResponse" name="parameters" />
</wsdl:message>
- <wsdl:message name="ARAuthenticate">
<wsdl:part element="s:AuthenticationInfo" name="parameters" />
</wsdl:message>
- <wsdl:message name="OpCreateSoapIn">
<wsdl:part element="s:OpCreate" name="parameters" />
</wsdl:message>
- <wsdl:portType name="CHG_Change_WebService_OpCreate_DisplayOnly_v2PortType">
- <wsdl:operation name="OpCreate">
<wsdl:input message="s:OpCreateSoapIn" />
<wsdl:output message="s:OpCreateSoapOut" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="CHG_Change_WebService_OpCreate_DisplayOnly_v2SoapBinding"

type="s:CHG_Change_WebService_OpCreate_DisplayOnly_v2PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="OpCreate">
<soap:operation soapAction="urn:CHG_Change_WebService_OpCreate_DisplayOnly_v2/OpCreate"

style="document" />
- <wsdl:input>
<soap:header message="s:ARAuthenticate" part="parameters" use="literal" />
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="CHG_Change_WebService_OpCreate_DisplayOnly_v2Service">
- <wsdl:port binding="s:CHG_Change_WebService_OpCreate_DisplayOnly_v2SoapBinding"

name="CHG_Change_WebService_OpCreate_DisplayOnly_v2Soap">
<soap:address

location="http://oldtas184/arsys/services/ARService?server=OLDTAS184&webService=CHG_Change_W

ebService_OpCreate_DisplayOnly_v2" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
------------
My simple invocation to this Java Web Service on Remedy looks like this..

------------
<cfinvoke

webservice="http://oldtas184/arsys/WSDL/public/OLDTAS184/CHG_Change_WebService_OpCreate_Disp

layOnly_v2" method="opCreate" returnvariable="aString">
<cfinvokeargument name="Description" value="test"/>
<cfinvokeargument name="Requester_Login_Name" value="testLogin"/>
<cfinvokeargument name="Requester_Name" value="testRequester"/>
</cfinvoke>
<cfoutput>#aString#</cfoutput>
------------------

The Exception I am receiving is as follows and I am not sure if there is any SOAP Header

which we are missing or a Complex types creating issues in Java and Coldfusion problem.

Could not perform web service invocation "opCreate".
Here is the fault returned when invoking the web service operation:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString:
MessageType: 2
MessageNum: 8961
MessageText: Required element expected in the input XML document
AppendedText: <Description>
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:
MessageType: 2
MessageNum: 8961
MessageText: Required element expected in the input XML document
AppendedText: <Description>
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
at

org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
at

org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unk

nown Source)
at org.apache.x...

PLEASE HELP ME AS ITS A DEADLINE FOR ME AND I AM ALREADY LATE IN DELIVERING THE WORKING

CODE.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1