Re: PHP SOAP WSDL rookie needs help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I didn't get it to work yet, but now I understand, what's the point.
Thank you for your time Jonathan!



Jonathan Pitcher-2 wrote:
> 
> There is a function to set the soap header. 
> (http://www.php.net/manual/en/soapheader.soapheader.php 
> )
> 
> This is where it gets VERY specific to the app you are connecting to.
> 
> Most apps use the Headers for Authentication so an example of one that  
> I built a while ago goes like this:
> 
> $authHeaders->user_name = $this->login;
> $authHeaders->pass_hash = md5($this->password);
> $soapHeaders[] = new SoapHeader('http://mysite/namespaces/user_auth',  
> 'authHeaders', $authHeaders, true);
> 
> $client->__setSoapHeaders( $soapHeaders );
> 
> Basically soap headers is like calling a pre function before calling  
> your main function.  So you need to understand what the service you  
> are trying to connect to is expecting before you can build the  
> connection.
> 
> Jonathan
> 
> 
> On Dec 22, 2010, at 3:06 PM, Mariaxx wrote:
> 
>>
>> Thanks for the tip. The message is now very clear and states:  
>> "Header is
>> missing" and if I've understood correctly, it comes straight from  
>> "their
>> server". This is great news!
>>
>> How would you set up a SOAP header call with PHP, normally? Are the  
>> body and
>> header being sent separately to the wsdl server, i.e. do I first send
>> headers with different call and after that the body part of the  
>> message
>> separately?
>>
>>
>> Jonathan Pitcher-2 wrote:
>>>
>>> Lets get some more information,  You are close, looks like their
>>> system is responding to you.
>>>
>>> You are getting 2 errors, one from them and one from PHP.  The one
>>> from PHP is saying you got an error back from them but you didn't
>>> handle it at all so since PHP doesn't know how to handle the error,  
>>> it
>>> errors out.
>>>
>>> Try this (no pun intended )
>>>
>>>
>>>
>>> try
>>> {
>>> 	$result = $client->createLoan($stuff);
>>> }
>>> catch (Exception $e)
>>> {
>>> 	echo $e->getMessage();
>>> }
>>>
>>>
>>> This should remove the php error, because now you are dealing with  
>>> the
>>> returned error and it also prints the error to the screen.
>>>
>>> Copy and paste the exact message you got back from the service, it
>>> will help in dealing with the issue.
>>>
>>> Jonathan
>>>
>>>
>>>
>>> On Dec 22, 2010, at 2:09 PM, Mariaxx wrote:
>>>
>>>>
>>>> Sure,
>>>>
>>>> $stuff = array('LoanInfo' =>array('LoanAmount' => 10000,
>>>> 		   					'RepaymentTime' => 5,
>>>> 		   					'Product' => 1,
>>>> 		   					'Salary' => 300000,
>>>> 		   					'AccommodationForm' => 'house',
>>>> 		   					'NrOfChildrenHome' => 3,
>>>> 		   					'BankAccountNumber' => 11111111111,
>>>> 		   					'Bank' => 'seb'),
>>>> 				'PersonalInfoMainBorrower'=>array('CivicRegNumber' =>
>>>> '251051006F',
>>>> 		   					'Firstname' => 'xx',
>>>> 		   					'LastName' => 'xxx',
>>>> 		   					'AddressCoName' => '',
>>>> 		   					'StreetAddtress' => 'xx 14',
>>>> 		   					'ZipCode' => 13537,
>>>> 		   					'City' => 'xx',
>>>> 		   					'Email' => 'xx'));
>>>>
>>>> $client = new
>>>> SoapClient('https://somesite/services/ApplicationFL?wsdl')
>>>> ;
>>>> $result = $client->createLoan($stuff);
>>>>
>>>> I also tried setting up headers with $client-
>>>>> __setSoapHeaders($header); but
>>>> I'm not sure, should I pass the header call via new SoapClient or
>>>> separately.
>>>>
>>>>
>>>> Jonathan Pitcher-2 wrote:
>>>>>
>>>>> Can I get you to post a snippet of code that shows you connecting  
>>>>> to
>>>>> the object and then calling a function if you have it ?
>>>>>
>>>>> Usually it goes something like:
>>>>>
>>>>> $client = new SoapClient(URL_TO_WSDL);
>>>>>
>>>>> $results = $client->myFunction(MyVar);
>>>>>
>>>>> That would be a very simplistic form.  Do you have something like
>>>>> that
>>>>> already ?
>>>>>
>>>>> Jonathan Pitcher
>>>>>
>>>>> On Dec 22, 2010, at 1:46 PM, Mariaxx wrote:
>>>>>
>>>>>>
>>>>>> I'm new to SOAP. I need to pass information via form to wsdl
>>>>>> service.
>>>>>>
>>>>>> I'm unable to understand few things:
>>>>>>
>>>>>> 1) Do I need to write <soapenv: Envelope... kind of tags, or do I
>>>>>> just get
>>>>>> them by using PHP functions such as $a = new SoapClient() ?
>>>>>>
>>>>>> 2) Do I still need to pass normal HTTP header with XML definition
>>>>>> plus SOAP
>>>>>> header + SOAP body with PHP
>>>>>>
>>>>>> I get response from the server saying that my Header is missing.
>>>>>> Also what does this mean: "Uncaught SoapFault exception:
>>>>>> [soap:Client]
>>>>>> Fault: java.lang.NullPointerException "
>>>>>>
>>>>>> I'd really appreciate your help. I shouldn't have taken this  
>>>>>> job : |
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/PHP-SOAP-WSDL-rookie-needs-help-tp30516854p30516854.html
>>>>>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> PHP Soap Mailing List (http://www.php.net/)
>>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> PHP Soap Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/PHP-SOAP-WSDL-rookie-needs-help-tp30516854p30517017.html
>>>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>>>
>>>>
>>>> -- 
>>>> PHP Soap Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>
>>>
>>> -- 
>>> PHP Soap Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://old.nabble.com/PHP-SOAP-WSDL-rookie-needs-help-tp30516854p30517377.html
>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>
>>
>> -- 
>> PHP Soap Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/PHP-SOAP-WSDL-rookie-needs-help-tp30516854p30519985.html
Sent from the Php - Soap mailing list archive at Nabble.com.


-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux