Php performs soapheader authentication and calls the interface

Source: Internet
Author: User
Php performs soapheader authentication and calls the interface $ client = new SoapClient ('http: // xxx. xxxx. xxx: 8099/mlf_webservice/publicRequest? Wsdl ', array ('encoding' => 'utf-8 '));
// $ Client-> soap_defencoding = 'utf-8 ';
$ Authvalues = new SoapVar (array ('username' => 'username', 'password' => 'password'), SOAP_ENC_OBJECT );
$ Header = new SoapHeader ('http: // xxx. xxx. xxx: 8099/mlf_webservice/publicRequest? Wsdl ', 'authrity', $ authvalues, false );
$ Client->__ setSoapHeaders ($ header );
$ Post_data = '{\ "version \": \ "10 \", \ "messageType \": \ "queryStoreList \", \ "signValue \": \ "4 \"} '; // The interface parameter must be in json format

$ Suc = $ client-> publicRequest ($ post_data );


Always report errors.


Reply to discussion (solution)

Please provide a real test account

Please provide a real test account


This is the account used for testing.

But how do you explain this prompt?
Fatal error: Uncaught SoapFault exception: [soap: Server] Incorrect username format ......

But how do you explain this prompt?
Fatal error: Uncaught SoapFault exception: [soap: Server] Incorrect username format ......


Is this caused by incorrect code writing, or is the error reported only when the user name and password are incorrect?

[Soap: Server] indicates that the exception is from the Server.
Apparently, the user name and password are incorrect.

[Soap: Server] indicates that the exception is from the Server.
Apparently, the user name and password are incorrect.



I changed the authentication, and now I am reporting
Fatal error: Uncaught SoapFault exception: [soap: Server] Fault occurred while processing.

[Soap: Server] indicates that the exception is from the Server.
Apparently, the user name and password are incorrect.



Server error:
Soap. SoapFault: Error Reading XMLStreamReader: Unepected EOF in prolog
[Row, col {unknown-source}]: [1, 0];


[Soap: Server] indicates that the exception is from the Server.
Apparently, the user name and password are incorrect.



The xml format is incorrect during soap header authentication.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.