|
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Web Service Issue , pls help
Hivishnu prasad 08/18/08 09:44 P > His. isaac dealey 08/18/08 09:51 P how to get the attachment from soap response and use it in coldfusionvishnu prasad 08/18/08 10:05 P Vishnu,Dave Phillips 08/19/08 08:08 A You may be able to "cfcontent" it directly - or you may need to store it asMark Kruger 08/18/08 10:31 P Hi Davevishnu prasad 08/19/08 09:55 P It would be a lot easier to respond if you provided some details.James Holmes 08/19/08 10:33 P This web service works but not the belowvishnu prasad 08/19/08 10:45 P Look at the WSDL. That method is expecting 4 parameters. You are onlyBrad Wood 08/19/08 10:52 P Yeah I've been messing with this and I have it working but only afterJames Holmes 08/19/08 11:11 P Yeah, I received the same error trying dummy info but I hoped it was just anBrad Wood 08/19/08 11:15 P Dude,Rick Sanders 08/19/08 10:43 P I believe this is the important piece of information:Brad Wood 08/19/08 10:46 P Hivishnu prasad 08/21/08 12:45 A No WS works , but struck with how to write the binary content into file , not able to parse into xmlvishnu prasad 08/21/08 06:06 A Hi We have a java webservice which will return the image as a soap attachment and another web service which will return the image as a binary data How can we use the image return by the web service in coldfusion? > Hi > > We have a java webservice which will return the image as a soap > attachment and another web service which will return the image as a > binary data > > How can we use the image return by the web service in coldfusion? I believe... <cffile action="write" file="/path/to/file.jpg" output="#binary#" /> -- s. isaac dealey ^ new epoch isn't it time for a change? ph: 781.769.0723 http://onTap.riaforge.org/blog how to get the attachment from soap response and use it in coldfusion Could you please provide with a code snippet? ----- Excess quoted text cut - see Original Post for more ----- Vishnu, Do you already have any current code that you are using? Your request is not completely clear, but based on what I am 'assuming', you want to know how you can invoke the java web service and retrieve the attachment from the soap response. I *think* you could do this with CFHTTP. CFHTTP can retrieve binary data by specifying getAsBinary="yes" in the CFHTTP call. So your call might look something like this: <cfhttp url="{url to web service here}" getAsBinary="yes" path="{path to folder where you want to store binary file here}" filename="{filename you want for image}" ...any other attributes you need > ....your cfhttpparam tags, if needed .... </cfhttp> After you do that, you should then be able to retrieve the file a number of ways: 1. if you just want to display the file, and it is in your web root: <img src="{path and filename of the image you retrieved}"> 2. If you want to display the file, and it is not in your web root: <cfcontent ...> (can't remember the parameters right now, but you can check the docs) 3. If you want to move the file somewhere, then use: <cffile action="move" source="{path and filename of image you retrieved}" destination="{new destination}"> If this is not what you are looking for, please describe in more detail exactly what you are trying to do with the data returned from the web service and post any code you may already be using. Sincerely, Dave Phillips how to get the attachment from soap response and use it in coldfusion Could you please provide with a code snippet? You may be able to "cfcontent" it directly - or you may need to store it as a file of the correct type and extension. -mark Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com Hi We have a java webservice which will return the image as a soap attachment and another web service which will return the image as a binary data How can we use the image return by the web service in coldfusion? Hi Dave I dont have a web service code , i tried to access the public web serive from xmethod which return the image , but somehow its not working This is the web service http://www.xmethods.net/ve2/ViewListing.po?key=uuid:861CB6D3-1E2A-BA27-BDDE-E9FEF283E518 ----- Excess quoted text cut - see Original Post for more ----- It would be a lot easier to respond if you provided some details. What is not working? Post some code. Do you get an error? If so, what does the error say? > Hi Dave > > I dont have a web service code , i tried to access the public web serive from xmethod which return the image , but somehow its not working > > This is the web service > http://www.xmethods.net/ve2/ViewListing.po?key=uuid:861CB6D3-1E2A-BA27-BDDE-E9FEF283E518 > -- mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ This web service works but not the below Working File <cfset code = "0"> <cfset BarSize = "15"> <cfset ShowCodeString = "true"> <cfset Title = "PrasadVishnu"> <cfinvoke webservice="http://www.webservicex.com/barcode.asmx?WSDL" method="Code39" returnvariable="retVal"> <cfinvokeargument name="code" value="#code#"> <cfinvokeargument name="BarSize" value="#BarSize#"> <cfinvokeargument name="ShowCodeString" value="#ShowCodeString#"> <cfinvokeargument name="Title" value="#Title#"> </cfinvoke> <cffile action="write" file="c:\Vishnufile.jpg" output="#retVal#" /> Not working <cffile action="write" file="c:\Vishnufile.jpg" output="#retVal#" /> <cfset Mynumber = "0123"> <cfset ImageType = "PNG"> <cfinvoke webservice="http://www.flash-db.com/services/ws/barCodes.wsdl" method="doBarCodes" returnvariable="retVal"> <cfinvokeargument name="num" value="#Mynumber#"> <cfinvokeargument name="imgtype" value="#ImageType#"> </cfinvoke> <cffile action="write" file="c:\Vishnufile1.jpg" output="#retVal#" /> Error Web service operation doBarCodes with parameters {imgtype={PNG},num={0123}} cannot be found. Thanks Vishnu ----- Excess quoted text cut - see Original Post for more ----- au/blog/ Look at the WSDL. That method is expecting 4 parameters. You are only supplying two. <message name="doBarCodes"> <part name="username" type="xsd:string"/> <part name="password" type="xsd:string"/> <part name="num" type="xsd:string"/> <part name="imgtype" type="xsd:string"/> </message> Error > Web service operation doBarCodes with parameters > {imgtype={PNG},num={0123}} cannot be found. Yeah I've been messing with this and I have it working but only after writing my own WSDL to get around this error: org.xml.sax.SAXException: Found character data inside an array element while deserializing Anyway, use a username of "any" and password of "any" as per their PHP example. The change I made to the wsdl was to replace xsd:base64Binary with xsd:anyType and it works. The way to output the result to the user then becomes: <cfinvoke webservice="http://your own version of the.wsdl" method="doBarCodes" returnvariable="doBarCodesRet" > <cfinvokeargument name="username" value="any"/> <cfinvokeargument name="password" value="any"/> <cfinvokeargument name="num" value="123456"/> <cfinvokeargument name="imgtype" value="jpg"/> </cfinvoke> <cfcontent type="image/jpeg"><cfoutput>#toString(ToBinary(doBarCodesRet))#</cfoutput> ----- Excess quoted text cut - see Original Post for more ----- Yeah, I received the same error trying dummy info but I hoped it was just an error related to having the wrong login info. That could be problematic if their WSDL isn't correct. ~Brad ----- Excess quoted text cut - see Original Post for more ----- Dude, Read the top right of the page. The domain is expired! flash-db.com expired on 07/26/2008 and is pending renewal or deletion Rick Sanders Webenergy Canada: 902-431-7279 USA: 919-799-9076 Canada: www.webenergy.ca USA: www.webenergyusa.com Hi Dave I dont have a web service code , i tried to access the public web serive from xmethod which return the image , but somehow its not working This is the web service http://www.xmethods.net/ve2/ViewListing.po?key=uuid:861CB6D3-1E2A-BA27-BDDE- E9FEF283E518 ----- Excess quoted text cut - see Original Post for more ----- I believe this is the important piece of information: "The image is base64 encoded so that it can easily travel via Soap. The user is required to decode it back to binary for display." You will probably need to ToBinary() the result to to turn the base64 back to a binary object. I would create an example call, but the webservice appears to require a username and password. I'm guess that the call to the web service will probably look something like this: <cfset ws_response = createobject("webservice","http://www.flash-db.com/services/ws/barCodes.wsdl").doBarCodes("username","password","123","JPG")> ~Brad ----- Excess quoted text cut - see Original Post for more ----- Hi when i try to access the web servies it gives the below error Web service operation RetrieveDocument with parameters {appUserID={_CISWS2},DocumentNumber={189425},ProfileForm={EKRIS_LAD_CPD_PF},DMlib={EKRIS},userID={_CISWS2}} cannot be found. Can someone help me how to acess the ws Below is my WSDL <?xml version="1.0" encoding="utf-8" ?> - <!-- @editor-info:link autogen="false" source="" --> - <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:conv="http://www.openuri.org/2002/04/soap/conversation/" xmlns:cw="http://www.openuri.org/2002/04/wsdl/conversation/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:jms="http://www.openuri.org/2002/04/wsdl/jms/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://www.openuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.openuri.org/"> - <types> + <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:ope="http://www.openuri.org/" elementFormDefault="qualified" targetNamespace="http://www.openuri.org/"> - <s:element name="RetrieveDocument"> - <s:complexType> - <s:sequence> <s:element name="DMlib" type="s:string" minOccurs="0" /> <s:element name="DocumentNumber" type="s:string" minOccurs="0" /> <s:element name="VersionNo" type="s:string" minOccurs="0" /> <s:element name="ProfileForm" type="s:string" minOccurs="0" /> <s:element name="appUserID" type="s:string" minOccurs="0" /> <s:element name="userID" type="s:string" minOccurs="0" /> </s:sequence> </s:complexType> </s:element> - <s:element name="RetrieveDocumentResponse"> - <s:complexType> - <s:sequence> <s:element name="RetrieveDocumentResult" type="ope:Profile" minOccurs="0" /> </s:sequence> </s:complexType> </s:element> <s:element name="Profile" nillable="true" type="ope:Profile" /> - <s:complexType name="Profile"> - <s:sequence> <s:element name="ContentMimeType" type="s:string" minOccurs="0" /> <s:element name="ProfileName" type="s:string" minOccurs="0" /> <s:element name="ProfileType" type="s:string" minOccurs="0" /> <s:element name="ProfileTitle" type="s:string" minOccurs="0" /> <s:element name="ProfileProperties" type="ope:ProfilePropertyList" minOccurs="0" /> <s:element name="LocalFilePath" type="s:string" minOccurs="0" /> <s:element name="ErrorMsgs" type="ope:ArrayOfString" minOccurs="0" /> </s:sequence> </s:complexType> - <s:complexType name="ProfilePropertyList"> - <s:sequence> <s:element name="ProfileProperties" type="ope:ArrayOfProfileProperty" minOccurs="0" /> </s:sequence> </s:complexType> - <s:complexType name="ArrayOfProfileProperty"> - <s:sequence> <s:element name="ProfileProperty" type="ope:ProfileProperty" nillable="true" minOccurs="0" maxOccurs="unbounded" /> </s:sequence> </s:complexType> - <s:complexType name="ProfileProperty"> - <s:sequence> <s:element name="PropertyName" type="s:string" minOccurs="0" /> <s:element name="PropertyValue" type="s:string" minOccurs="0" /> </s:sequence> </s:complexType> - <s:complexType name="ArrayOfString"> - <s:sequence> <s:element name="String" type="s:string" nillable="true" minOccurs="0" maxOccurs="unbounded" /> </s:sequence> </s:complexType> </s:schema> </types> - <message name="RetrieveDocumentSoapIn"> <part name="parameters" element="s0:RetrieveDocument" /> </message> - <message name="RetrieveDocumentSoapOut"> <part name="parameters" element="s0:RetrieveDocumentResponse" /> </message> - <message name="RetrieveDocumentHttpGetIn"> <part name="DMlib" type="s:string" /> <part name="DocumentNumber" type="s:string" /> <part name="VersionNo" type="s:string" /> <part name="ProfileForm" type="s:string" /> <part name="appUserID" type="s:string" /> <part name="userID" type="s:string" /> </message> - <message name="RetrieveDocumentHttpGetOut"> <part name="Body" element="s0:Profile" /> </message> - <message name="RetrieveDocumentHttpPostIn"> <part name="DMlib" type="s:string" /> <part name="DocumentNumber" type="s:string" /> <part name="VersionNo" type="s:string" /> <part name="ProfileForm" type="s:string" /> <part name="appUserID" type="s:string" /> <part name="userID" type="s:string" /> </message> - <message name="RetrieveDocumentHttpPostOut"> <part name="Body" element="s0:Profile" /> </message> - <portType name="retrieveDocumentAttachmentSoap"> - <operation name="RetrieveDocument"> <documentation>Retrieve Document Web Service Description: This web service retrieves the required document profile and the document file for the user id Parameters: DMLib - Name of the DM Repository/Library where the document to be retrieved resides in DocumentNumber - The unique identifier of the document to be retrieved VersionNo - Optional parameter. The version of thew document to retrieve. If null, will retrieve latest version ProfileForm - The document profile Form to use appUserID - The user ID of the application account calling this webservice (DM account) userID - The user ID of the actual user using this webservice (DM account) Returns: Document Profile of successfully retrieved document Byte Stream of document Retrieved String Array of Error Messages</documentation> <input message="s0:RetrieveDocumentSoapIn" /> <output message="s0:RetrieveDocumentSoapOut" /> </operation> </portType> - <portType name="retrieveDocumentAttachmentHttpGet"> - <operation name="RetrieveDocument"> <documentation>Retrieve Document Web Service Description: This web service retrieves the required document profile and the document file for the user id Parameters: DMLib - Name of the DM Repository/Library where the document to be retrieved resides in DocumentNumber - The unique identifier of the document to be retrieved VersionNo - Optional parameter. The version of thew document to retrieve. If null, will retrieve latest version ProfileForm - The document profile Form to use appUserID - The user ID of the application account calling this webservice (DM account) userID - The user ID of the actual user using this webservice (DM account) Returns: Document Profile of successfully retrieved document Byte Stream of document Retrieved String Array of Error Messages</documentation> <input message="s0:RetrieveDocumentHttpGetIn" /> <output message="s0:RetrieveDocumentHttpGetOut" /> </operation> </portType> - <portType name="retrieveDocumentAttachmentHttpPost"> - <operation name="RetrieveDocument"> <documentation>Retrieve Document Web Service Description: This web service retrieves the required document profile and the document file for the user id Parameters: DMLib - Name of the DM Repository/Library where the document to be retrieved resides in DocumentNumber - The unique identifier of the document to be retrieved VersionNo - Optional parameter. The version of thew document to retrieve. If null, will retrieve latest version ProfileForm - The document profile Form to use appUserID - The user ID of the application account calling this webservice (DM account) userID - The user ID of the actual user using this webservice (DM account) Returns: Document Profile of successfully retrieved document Byte Stream of document Retrieved String Array of Error Messages</documentation> <input message="s0:RetrieveDocumentHttpPostIn" /> <output message="s0:RetrieveDocumentHttpPostOut" /> </operation> </portType> - <binding name="retrieveDocumentAttachmentSoap" type="s0:retrieveDocumentAttachmentSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> - <operation name="RetrieveDocument"> <soap:operation soapAction="http://www.openuri.org/RetrieveDocument" style="document" /> - <input> <soap:body use="literal" /> </input> - <output> <soap:body use="literal" /> </output> </operation> </binding> - <binding name="retrieveDocumentAttachmentHttpGet" type="s0:retrieveDocumentAttachmentHttpGet"> <http:binding verb="GET" /> - <operation name="RetrieveDocument"> <http:operation location="/RetrieveDocument" /> - <input> <http:urlEncoded /> </input> - <output> <mime:mimeXml part="Body" /> </output> </operation> </binding> - <binding name="retrieveDocumentAttachmentHttpPost" type="s0:retrieveDocumentAttachmentHttpPost"> <http:binding verb="POST" /> - <operation name="RetrieveDocument"> <http:operation location="/RetrieveDocument" /> - <input> <mime:content type="application/x-www-form-urlencoded" /> </input> - <output> <mime:mimeXml part="Body" /> </output> </operation> </binding> - <service name="retrieveDocumentAttachment"> - <port name="retrieveDocumentAttachmentSoap" binding="s0:retrieveDocumentAttachmentSoap"> <soap:address location="http://urasvr46.ura.gov.sg:8011/webservices/jws/retrieveDocumentAttachment.jws" /> </port> - <port name="retrieveDocumentAttachmentHttpGet" binding="s0:retrieveDocumentAttachmentHttpGet"> <http:address location="http://urasvr46.ura.gov.sg:8011/webservices/jws/retrieveDocumentAttachment.jws" /> </port> - <port name="retrieveDocumentAttachmentHttpPost" binding="s0:retrieveDocumentAttachmentHttpPost"> <http:address location="http://urasvr46.ura.gov.sg:8011/webservices/jws/retrieveDocumentAttachment.jws" /> </port> </service> </definitions> No WS works , but struck with how to write the binary content into file , not able to parse into xml below is the output from WS ------=_Part_31_11976965.1219312819993 Content-Type: text/xml; charset=utf-8 Content-Transfer-Encoding: 8bit Content-ID: __WLS__1219312819993__SOAP__ image/jpgEKRIS_LAD_CPD_PFORGANIZATION_LINK0Z_VALCASEID_BUFF1880422Z_VALDESIGNATION_BUFF8973DOCNAMEhillsPROFILE_TYPE_LINK0AUTHOR_IDIVANAUTHOR_NAMENG CHI CHEUNG, IVANFORM2452ROLE_IDIS-T404ROLE_DESCRIPTIONTeam 4 MemberTYPIST_ID_CISWS2ITEM_TYPEDTYPE_IDDEFAULTDOCTYPE_DESCRDefault Document TypePD_SUPSEDESNAPP_IDPUB JPGPD_SUPSEDEDNMSG_ITEM0DELIVER_REC0Z_FILEREFeURA/CDD_IS/CISZ_CASEIDIS/CIS- Vol 1Z_CASE_TITLEIS - CISDOCTYPE_STORAGEADOCTYPE_RETENTION0DOCTYPE_FULLTEXTYEMAIL_SENT01-01-1753 0:00:00Z_FOLDERFLAGYDOCNUM189425RECORDNREAD_ONLYNRELATEDNFULLTEXTYSUSPENDEDNSTORAGEAGENERIC_EVENT01-01-1753PD_VITALNSTATUS0SECURITY1E:/common_repository/UatEkrisDomain/cdd/eKris/temp/_CISWS2_26169-hills.jpg ------=_Part_31_11976965.1219312819993 Content-Type: image/jpg <Binary Content here> ------=_Part_31_11976965.1219312819993--
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||