Welcome to Dream.In.Code
Become a PHP Expert!

Join 136,910 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,734 people online right now. Registration is fast and FREE... Join Now!




consuming .net webservice using php

 
Reply to this topicStart new topic

consuming .net webservice using php

riaz1983
10 Mar, 2008 - 04:34 AM
Post #1

New D.I.C Head
*

Joined: 10 Mar, 2008
Posts: 3

Hi,
I am trying to consume .net web service using php.I have acheived it but problem arraises when i try to consume a web service function having a object as its parameter.I was not able to pass function with object as parameter to the web service function.

The below is the web service function coding.

CODE

public MemberView ChangeEmailAddress(InfiSession infiSes, string oldEmailAddress, string newEmailAddress)
        {
            try
            {
                MemberManager memberManager = new MemberManager(infiSes);
                Member mem = memberManager.ChangeEmailAddress(infiSes.MemberId, oldEmailAddress, newEmailAddress);
                MemberView memView = memberManager.GetMemberViewByEmailAddress(mem.EmailAddress);
                return (memView);
            }
            catch (Exception ex)
            {
                InfiDebugLog.AppServer.WriteError(ex);
                throw FaultUtility.GetFaultException(ex);
            }
        }


I want to consume the ChangeEmailAddress function.For that i need to pass 3 parameters an object named infiSes,oldemail address,new email address.

Here is the php code what i tried.

CODE

<?php
ob_start();
session_start();
require_once('nusoap.php');
$client = new nusoap_client('http://n1app1exc.corp.lan:8082/MemberService.svc?wsdl', 'wsdl');

$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
}

$client->soap_defencoding = 'UTF-8';
$client->setHTTPEncoding('deflate, gzip');

$id = $infiSes =$_SESSION['mid'];
var_dump($id);

echo $memberid;
$old = $_REQUEST['oldemail'];
$new = $_REQUEST['Newemail'];      
print "<pre>";
$infi=$client->call("MemberService->InfiSession()" );


$infi=array(
"_MemberId"=>array("name"=>"_MemberId","type"=>'xsd:long',"value"=>$infiSes),
"_ContextOrgId"=>array("name"=>"_ContextOrgId","type"=>"xsd:int","value"=>"0"),
"_OrgMemberId"=>array("name"=>"_OrgMemberId","type"=>"xsd:int" ,"value"=>"0" ),
"_ServerUrl"=>array("name"=>"_ServerUrl","type"=>"xsd;string" ,"value"=>"")));

$result = $client->call('ChangeEmailAddress', array ("infiSes" =>$infi,"oldEmailAddress"=>$old,"newEmailAddress" =>$new));
var_dump($result);
if($result['faultstring']!="")
{ echo $result['faultstring']['!'];
}
print_r($result);

?>



I was getting result as member id invalid.


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/3/08 09:58PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month