?
Solved

Webservice question

Posted on 2010-01-11
17
Medium Priority
?
232 Views
Last Modified: 2012-05-08
I need to know where I start for the following.... I have been given a Web Service SSO URL test against, I need to open a new window and send login details accross. all i have is the xml. my question is in CF how to i go about this? CFHTTP, xml, cfinvoke etc? below is what I hev been given

<Envelope Version="2.0" Organisation="0" StaffId="-9403-4E3AB0F4">
  <OrganisationUnitHierarchy>
    <OrganisationUnit OrganisationUnitId="CAF" Name="TEST" Command="Write">
      <OrganisationUnit OrganisationUnitId="BD63" Name="Test" Command="Write" />
    </OrganisationUnit>
  </OrganisationUnitHierarchy>
  <StaffCollection>
    <Staff OrganisationUnitId="3" StaffId="47" FirstName="Test" LastName="as" Email="Test@sds.com">
    </Staff>
  </StaffCollection>
</Envelope>
0
Comment
Question by:pigmentarts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 8
17 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 26284856
First, you'd need the webservice's WSDL to tell you what methods are available, and what parameters you'd need to use.  Once you have that info, you can decide whether to call the webservice with cfinvoke/createObject or CFHTTP.

Usually,  cfinvoke/createObject is good for simple webservices and cfhttp is better for more complex ones. But as long as you construct the right code, either one should work.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 26284869
> First, you'd need the webservice's WSDL

.. ie We can't be more specific without seeing the wsdl (or at least the relevant portions)
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26284959
so the first thing I do is call the WSDL right?

I tried this...

<cfscript>
  ws=createobject("webservice", "https://thewebserviceexample/ExternalSignin.asmx?WSDL");
</cfscript>
<cfdump var="#ws#" />

and I get returned back a dump that looks like this....

object of org.tempuri.ExternalSignInSoapStub
Class Name       org.tempuri.ExternalSignInSoapStub
Methods       
Method       Return Type
echo(java.lang.String)       java.lang.String
execute(java.lang.String)       java.lang.String
translate(java.lang.String)       java.lang.String
translateAndExecute(java.lang.String)       java.lang.String
Fields       
Field       Value
java.lang.String ENDPOINT_ADDRESS_PROPERTY       javax.xml.rpc.service.endpoint.address
java.lang.String PASSWORD_PROPERTY       javax.xml.rpc.security.auth.password
java.lang.String SESSION_MAINTAIN_PROPERTY       javax.xml.rpc.session.maintain
java.lang.String USERNAME_PROPERTY       javax.xml.rpc.security.auth.username


so what do I now do with this information?
0
Stressed Out?

Watch some penguins on the livecam!

 
LVL 52

Expert Comment

by:_agx_
ID: 26285024
> so what do I now do with this information?

You need to look at the WSDL to determine

A) How you pass the login info to this webservice. (Though it is  ... and
B) How to call whatever method you need

We can't be more specific without seeing the WSDL
0
 
LVL 52

Expert Comment

by:_agx_
ID: 26285059
> We can't be more specific without seeing the WSDL

(Ignoring the login issue for a moment) it looks like the web service has several methods that accept a simple string.  Which you could probably call like this

....
<cfset ws.execute("YourString")>

But again, that is just a guess. Every web service is different, so it may or may not work.
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285100
i have attached the output from the WSDL when I visit the WSDL URL. from what i know I need to pass in information to create a user then login them in after. I always write first then login them in.
ExternalSignin.asmx.xml
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285114
will try again EE did not like the asmx ext one below should work
ExternalSignin.xml
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285126
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285258
thanks for you help so far so using above, I create the object which consumes the service like so...

<cfscript>
  ws=createobject("webservice", "https://staging-platform.distribution-technology.com/PSP1002/Secure/Services/ExternalSignin.asmx?WSDL");
</cfscript>
<cfdump var="#ws#" />

how so I then pass in the data I need and launch login, where does the example Envelope I was given come into play?
0
 
LVL 52

Expert Comment

by:_agx_
ID: 26285319
You can call the simple method echo() like this.  Is there any login requirement for this WS?

<cfset ws = createObject("webservice", "https://staging-platform.distribution-technology.com/PSP1002/Secure/Services/ExternalSignin.asmx?WSDL") />
<cfset result = ws.echo("Test") />
<cfdump var="#result#">
0
 
LVL 52

Expert Comment

by:_agx_
ID: 26285336
> where does the example Envelope I was given come into play?

I don't know.  Most of the methods in the wsdl you provided accept 1 simple string. So I'm not seeing the relationships here ...
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285391
They said I need to first create or update the user each time using the request, then login. So each time I login I need to send...

Org ID
Company
User ID
Forename      
Surname      
Adviser      
Admin      
Role Level

I then got a SSO XML example

<Envelope Version="2.0" OrganisationUnitId="05B09E12-5564-45B6-AD81-65A362ABBD63" StaffId="29C3D595-9403-4E3A-B0F4-9D29EEA94D47">
  <OrganisationUnitHierarchy>
    <OrganisationUnit OrganisationUnitId="455343E0-3EB4-482E-83F4-6713E15C7CAF" Name="SimplyBiz" Command="Write">
      <OrganisationUnit OrganisationUnitId="05B09E12-5564-45B6-AD81-65A362ABBD63" Name="Reading Investments" Command="Write" />
    </OrganisationUnit>
  </OrganisationUnitHierarchy>
  <StaffCollection>
    <Staff OrganisationUnitId="05B09E12-5564-45B6-AD81-65A362ABBD63" StaffId="29C3D595-9403-4E3A-B0F4-9D29EEA94D47" FirstName="Test" LastName="Adviser" Email="Test@Adviser.com">
      <RoleIdCollection>
        <Role RoleId="6C9C93AD5E22482E904FF3DA0796B94E" />
        <Role RoleId="C5CD42A6FCEF406FBCB9F82E5EB0D0B6" />
        <Role RoleId="9AA8EFC13ED94BA2BA7CD36724592544" />
        <Role RoleId="8CFCA8056E4B4B80A41B7F78A1EFDFCA" />
        <Role RoleId="D09CAA50180E4741A7FCFA1BBF09E9D4" />
        <Role RoleId="3D2F8552F57649199F93B2939EB886F3" />
        <Role RoleId="40127B4E0EDE4DD9A2449641DD27552C" />
      </RoleIdCollection>
    </Staff>
  </StaffCollection>
</Envelope>


0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285402
was also told to use the TranslateAndExecute method which means nothing to me?
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 26285577
I just noticed the SSO part. Unfortunately, I am not overly familiar with Single Sign On web services. In theory it is similar to some I've worked with. But that said, I'm not sure I'll have the experience to answer a question about interacting with the particular type of service - from CF.

> ... use the TranslateAndExecute method which means nothing to me?

I'm sorry to say it doesn' t mean much to me either.  Yes, the concepts make sense. But unfortunately, every web service is different.  I can see that the TranslateAndExecute method accepts some sort of XML string. But I've no way of knowing what that xml string should be.

<s:element name="TranslateAndExecute">
     ...
    <s:element minOccurs="0" maxOccurs="1" name="xml" type="s:string"/>
     ...
</s:element>

Instead of just the "Envelope" snippet, you might ask them for a complete (and working) example of the type of request you're trying to implement.  Many companies with complex web services provide working SOAP examples in addition to the API's and wsdl.



0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285867
Is there anything I can look at in cf as an example of this sending data and sign on? Thanks for all your help
0
 
LVL 12

Author Comment

by:pigmentarts
ID: 26285868
Is there anything I can look at in cf as an example of this sending data and sign on? Thanks for all your help
0
 
LVL 52

Expert Comment

by:_agx_
ID: 26286211
Unfortunately, I don't know anything offhand. Most web services that require some sort of authentication use username/password, that you can pass into either cfinvoke or cfobject

<cfinvoke webservice="..." username="(user)" password="(password)"...>

I really don't know the equivalent with this web service.
0

Featured Post

Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 8 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question