Have you tried the addSOAPRequestHeader function? Use this in conjunction
with createObject to pass the username and password to the service. See
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_a-b_03.html

HTH.

Best Regards,
Donnie Bachan
"Nitendo Vinces - By Striving You Shall Conquer"
======================================================================
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.


On Fri, Feb 22, 2013 at 9:13 PM, Stephane Vantroyen <[email protected]> wrote:

>
> Hello,
>
> usually I have no problem consuming webservices, but this time I don't
> understand what I do wrongly; before being able to call any method, I
> should login, passing username and password in the soap headers; and there
> comes the pain : I try to call it via createboject, cfinvoke or even with
> cfhttp like mentionned in this post (
> http://blog.brijeshradhika.com/2011/04/consuming-webservice-using-coldfusion.html
> ),
> I can't make it work.
>
> The documentation of the webservice provides a php example (see below).
> Anyone of you guys being able to translate into Coldfusion code?
>
> Thanks in advance
>
>
>
> /* Create the UsernameToken class */
> class UsernameToken {
>       public $Username;
>       public $Password;
> public function __construct($username, $password) { $this -> Username =
> $username;
> $this -> Password = $password;
> } }
> /* Initialise the SOAP client */
> $client = new SoapClient('http://www.thesite.nl/api/thesite.wsdl', array(
> trace => 1 ));
> /* Send user authentication headers */
> $ut = new UsernameToken('username', 'password');
> $soapHeaders[] = new SoapHeader('
> http://schemas.xmlsoap.org/ws/2002/07/utility/', 'UsernameToken', $ut);
> $client -> __setSoapHeaders($soapHeaders);
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:354660
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to