Ben bir. Net WCF webcoder bağlamak ve bir usercontext dönmek için bir php müşteri almak biraz yardıma ihtiyacım var.
Ben o. Net çalışmak için olsun ama php olamaz.
Eğer diğer yöntemlere geçmek bir usercontext döndürür ilk imzalamak zorunda.
Developer Help: The UserContext property gets or sets the DCUserContext. Once SignIn is successful, a UserContext is assigned and every call made will need this UserContext.
webservice wisdl olan https://nspservices.natr.com/eCommerce/eCommerce.wsdl
Ben bir erro döndürür usercontext dönmek için kullanmaya çalışıyorum php kodu dahil ve ben çalışır VB.net kodu bir örnek dahil.
:Testing PHP Code returns error
<?php
$client = new SoapClient('https://nspservices.natr.com/eCommerce/eCommerce.wsdl');
echo '<pre>'; var_dump($client->__getFunctions()); echo '</pre><br /><br /><br />';
try
{
$client->__soapCall('Signin',
array(
array('request' =>
array(
'UserName' => 'username',
'ClientPassword' => 'password',
'AccountNum' => 'accountnum',
'NSPPassword' => 'password',
'Language' => '1',
'Market' => '1'
)
)
)
);
}
catch (Exception $e)
{
echo $e->getMessage();
}
?>
Response:
array(12) {
[0]=>
string(41) "SignInResponse SignIn(SignIn $parameters)"
[1]=>
string(65) "GetProductInfoResponse GetProductInfo(GetProductInfo $parameters)"
[2]=>
string(95) "GetProductsByFirstLetterResponse GetProductsByFirstLetter(GetProductsByFirstLetter $parameters)"
[3]=>
string(77) "GetProductSpecialsResponse GetProductSpecials(GetProductSpecials $parameters)"
[4]=>
string(41) "SignUpResponse SignUp(SignUp $parameters)"
[5]=>
string(53) "PlaceOrderResponse PlaceOrder(PlaceOrder $parameters)"
[6]=>
string(83) "GetGroupDownlineTreeResponse GetGroupDownlineTree(GetGroupDownlineTree $parameters)"
[7]=>
string(68) "GetOrderHistoryResponse GetOrderHistory(GetOrderHistory $parameters)"
[8]=>
string(47) "GetTotalResponse GetTotal(GetTotal $parameters)"
[9]=>
string(47) "GetTaxesResponse GetTaxes(GetTaxes $parameters)"
[10]=>
string(56) "GetShippingResponse GetShipping(GetShipping $parameters)"
[11]=>
string(113) "GetTrackingNumberByOrderNumberResponse GetTrackingNumberByOrderNumber(GetTrackingNumberByOrderNumber $parameters)"
}
Object reference not set to an instance of an object.
VB .net Code that works:
Imports nsgatewayvb.eCommerce
' extablish a procy to call the web service
Dim proxy As New IeCommerceClient()
' Sign into the service. All calls require a signin. The UserContext from the signin
' is then passed to each subsequent call. The UserContext remains valid for 1 hour.
Dim s As DCSignIn = Helper.Signin(proxy, "username", "userpassword", "accountnum", "accountpassword")
If s Is Nothing Then
' couldn't log in
Console.WriteLine("Unable to sign in to eCommerce system")
Exit Sub
End If
If s.[Error] IsNot Nothing AndAlso s.[Error].ErrorNumber <> 0 Then
Console.WriteLine("Error {0} : '{1}' during signup", s.[Error].ErrorNumber, s.[Error].Description)
Exit Sub
End If
' get product information
Helper.GetProductInfo(proxy, s.UserContext)