Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Consuming wsdl, PLEASE HELP!!!

Explorer ,
Jul 09, 2009 Jul 09, 2009

I'm on a new project and this is the first time I'm going to work with web services using wsdl. I read some tutorials from the net and books today but still don't get the point especially what next after using cfinvoke.

I used cfinvoke as suggested by the adobe live doc, tutorial and get the returnvariable, dumped this variable and I can see a structure in red color with class name and many methods.

my question is, what next?

I can't find any article that help me describe the next step.

How am I supposed to get the data or the xml file (?), sorry I'm very new with web service.

TOPICS
Getting started
3.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 10, 2009 Jul 10, 2009

I guess consuming wsdl is not the right term since I already got the object. The better term may be is how to view or get data out from the object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 10, 2009 Jul 10, 2009

Can you attach the XML (or a screen shot) that's produced when you dump the object? It'll probably be the easiest way for someone to help direct you in extracting nodes and values from XML objects!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

I attached a screen shot and below is my codes to get that result shown on the screen shot.

In this cfinvoke I passed only one of the function, there are many other functions, I assumed I have to use cfinvoke again whenever I want to get different data back from this web services.

<cfinvoke

webservice="https://amn.mod.com/ws_20/generalquery.asmx?wsdl" method="GetAllColumns" returnvariable="result">

   <cfinvokeargument name="login" value="mylogin">

  <cfinvokeargument name="password" value="mypassword">

<cfinvoke>

<cfdump

var="#result#">

In my effort to search for an explanation/tutorial, I found this link: http://articles.techrepublic.com.com/5100-10878_11-5067756.html

I was very happy at first and this what brought me to try the following codes but unfortunately these codes returns yet another object with a different set of functions such as getColumn( ); getColumn_info( ) instead of the data I need.

<cfscript>

mydata =

structnew();

mydata.first_name = result.getAllColumnResults();

mydata.last_name = result.getAllColumnResults();

</cfscript>

<cfdump

var="#mydata#" label="mydata">

Note: I modified the url on my cfinvoke shown in this posting for security issues, this url involve many sensitive data and my cf invoke can only work if I put

the login & password as cfinvokeargument

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

It sounds like the data you are looking for is nested several objects deep in the XML returned by the web service.  Bear in mind that CF and the underlying Java web service classes convert the raw SOAP XML from the web service to Java objects.  The cfdump you posted is a listing of the Java object and its methods.

Things to try:

1. Examine the WSDL.  This should give you an idea of how the web service structures its data.  Please post the WSDL if possible.  Please specify what data you are expecting from the web service.

2. Try examining the raw SOAP XML returned by the web service using the GetSOAPResponse function.

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_e-g_59.html#5054378

3. Examine the Java objects returned by CFINVOKE.  Try a cfdump on each object to see what it returns, then cfdump the children of that object.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

Here is the partial screen shot of the wsdl for getAllColumns (it's a long list of columns)

Below is some description related to getAllColumns function in addition to the one I pasted on the attachment under wsdl content:

Return Syntax

AllColumnResults

The following is a sample of the AllColumnResults response.  This applies to the GetAllColumns web service method.

<ArrayOfAllColumnResults>

<AllColumnResults Column="first_name" Column_Info="nvarchar,75" Instance="false"/>

<AllColumnResults Column="last_name" Column_Info="nvarchar,75" Instance="false"/>

<AllColumnResults Column="donation_amount" Column_Info="money" Instance="true"/>

</ ArrayOfAllColumnResults >

Each field returned is represented by an AllColumnResults element.

·         AllColumnResults element

o   Will contain a Column attribute containing the name of the field.

o   Will contain a Column_Info attribute containing the data type of the field.

o   Will contain an Instance attribute indicating whether or not the field is an instance field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

It looks like getAllColumnResults(n) will return the item at position n in your array of column objects.  To extract Column, Column_Info, or Instance data call the corresponding get method.  Try something like  result.getAllColumnResults(0).getColumn()  to get the Column string from the first AllColumnResults record.  I'm assuming that the Java object will use a zero based array.  You may need to change to a one based array if my assumption is incorrect.

Can you post a sample of the information you'd like to extact?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

By using getAllColumns function I thought would be able to extract values of first_name, last_name, etc., such as those shown on the wsdl? am I wrong to make this assumption?

I'm sorry but this is the first time I'm working with web service, it's a new thing for me.

Have done a lot of reading since last week but have not been able to put the pieces together.

My original understanding is, I need to get a data from the other site so I can use that data for my site. My idea of getting the data is like what described in this link: http://articles.techrepublic.com.com/5100-10878_11-5067756.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

BYJ_wntrsnt wrote:

By using getAllColumns function I thought would be able to extract values of first_name, last_name, etc., such as those shown on the wsdl? am I wrong to make this assumption?

I'm sorry but this is the first time I'm working with web service, it's a new thing for me.

Have done a lot of reading since last week but have not been able to put the pieces together.

My original understanding is, I need to get a data from the other site so I can use that data for my site. My idea of getting the data is like what described in this link: http://articles.techrepublic.com.com/5100-10878_11-5067756.html

You will use the getAllColumns function to get the data you want.  Be aware that the getAllColumns function returns an instance of the AllColumnResults object.  The AllColumnResults object has getColumn, getColumn_Info, etc. get methods for each property of the AllColumnResults object.  This is analogous to the "results.getBookData().getTitle()" call in the tech republic article you refer to.  If you are looking for values of first_name, last_name, etc. perhaps you need to invoke a different method of the web service.  Posting the WSDL would be helpful.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

I followed your suggestion on GetAllColumns and did some testing myself. The good news is I got some data back, thank you!! but the bad news is I'm not yet confident that I understand the concept especially on knowing those sub functions such as the getColumn.

What I did to find out what functions exist under GetAllColumns, I did the following:

<cfscript>

mydata =

structnew();

mydata.

1 = result.getAllColumnResults();

</cfscript>

<cfdump

var="#mydata#" label="mydata">

Looking at the cfdump output, I can see 3 other functions: They're getColumn, getColumn_Info and isInstance functions.

Using these 3 functions I follow your suggestion, here is what I did to see the data:

<CFSET

mydata = structNew()>

<CFSCRIPT>

mydata.

01 = result.getAllColumnResults(0).getColumn();

mydata.

02 = result.getAllColumnResults(1).getColumn();

mydata.

03 = result.getAllColumnResults(2).getColumn();

etc...

</CFSCRIPT>

Then I tried to invoke a different function call, getOneMember, I also tried to see what children functions getOneMember has, trying to to do the same as above, dumped it out and I got error:

Element 1 is undefined in a CFML structure referenced as part of an expression.

ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.

How do I know what functions getOneMember function has under it and also other functions unless I dump it out like what I did with GetAllColumns?

Is there other way to look for the children functions without having to do what I did.

I attached the screen shot for getOneMember wsdl, from this file I can't tell what sub function getOneMember has.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

Please post the " getOneMember" code including the cfinvoke call and the cfdump.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

Here are the codes:

<cfinvoke

webservice="https://amn.mod.com/ws_20/generalquery.asmx?wsdl" method="GetOneMember" returnvariable="result2">

   <cfinvokeargument name="login" value="mylogin">

   <cfinvokeargument name="password" value="mypassword">

   <cfinvokeargument name="columns" value="firstname, Lastname,zip">

   <cfinvokeargument name="constituentId" value="0003009">

</cfinvoke>

<cfdump

var="#result2#">

<p>

<!--- Checking what are the sub functions of GetAllColumns --->

<cfscript>

mydata2 =

structnew();

mydata2.firstname

= result2.GetMemberInformation;

</cfscript>

<cfdump

var="#mydata2#" label="mydata2">

<p>

Error:

Element GETMEMBERINFORMATION is undefined in RESULT2.

The error occurred in C:\Inetpub\wwwroot\scratch\iModule\imodule_1.cfm: line 89
87 : <cfscript>
88 : mydata2 =structnew();
89 : mydata2.firstname  = result2.GetMemberInformation;
90 : </cfscript>
91 : 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

I suspect that GetMemberInformation needs parenthesis GetMemberInformation(). Have you also confirmed that the result2 object has a GetMemberInformation() method?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

I tried with parenthesis but I got this error:

The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request

Element FIRSTNAME is undefined in a CFML structure referenced as part of an expression.

ColdFusion cannot determine the line of the template that caused this error. This is often caused by an error in the exception handling subsystem.

Yes, the attachment I sent you shows that getMemberInformation() is there.

Is this the only way to drill down to see if there are more methods?

By the way, what I did with GetAllColumn, I used mydata.01, mydata.02, etc and I did not get any error

There is no column name 01.02. etc.

with GetMemberInformation on the other hand no matter what I did I keep getting error. I don't know if this matter.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

Things to try:

1. I see from your screenshot that there are two methods getMemberInformation(). One without parameters and one with an integer parameter. Try result2.getMemberInformation(0).

2. CFDUMP just result2.getMemberInformation() and/or result2.getMemberInformation(0). There may be some issue with your mydata2 struct that is not obvious from the code you posted.

3. Is it possible that getMemberInformation() is any empty array? I can't read the type from the screenshot you provided. Does ArrayLen(result2.getMemberInformation()) return a number?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 13, 2009 Jul 13, 2009

I tried both:

<cfscript>

mydata2 =structnew();

mydata2.firstname = result2.GetMemberInformation(0);

</cfscript>

<cfdump var="#mydata2#" label="mydata2"><p>

and

<cfset

Y = "#ArrayLen(result2.getMemberInformation())#">

Both showed this error:

I also attached the screen shot again

The following information is meant for the website developer for debugging purposes.
Error Occurred While Processing Request
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.

Null Pointers are another name for undefined values.

The error occurred in C:\Inetpub\wwwroot\scratch\iModule\imodule_1.cfm: line 85
83 : <cfdump var="#result2#"><p>
84 : 
85 : <cfset Y = "#ArrayLen(result2.getMemberInformation())#">
86 : 
87 : <cfdump var="#Y#">

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

Does this work?

<cfinvoke webservice="https://amn.mod.com/ws_20/generalquery.asmx?wsdl" method="GetOneMember" returnvariable="result2"> <cfinvokeargument name="login" value="mylogin"> <cfinvokeargument name="password" value="mypassword"> <cfinvokeargument name="columns" value="firstname, Lastname,zip"> <cfinvokeargument name="constituentId" value="0003009"> </cfinvoke> <cfset memberInfo=result2.getMemberInformation() ></cfset> <cfdump var="#memberInfo#">

You might also investigate using the getJavaMetadata function from cflib.org to see if you can get more info about the web service's object structure.

http://www.cflib.org/udf/getJavaMetadata

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 14, 2009 Jul 14, 2009

I'm sorry for stop responding but Ineed to attend our weekly meeting. No it is not yet working and I have tried many things but unfortunately none is working!

I want to thank you for your generosity in assisting me with this problem, if today you still have the time and desire, I'm including the whole wsdl file, I copied it into a word doc.

About the getJavaMetadata, I'll try to see if I can use that.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 14, 2009 Jul 14, 2009
LATEST

got the getJavaMetadata worked cfdump did not show anything different.

CFDUMP included

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jul 13, 2009 Jul 13, 2009

It would be easier to assist you if you would provide:

1. Your entire WSDL.

2. The entire CF code. You only provide lines 83-87, it is possible that there is a problem prior to line 83.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources