php - Missing UsernameToken element -


I am receiving a request in the following method, but the soap message does not include userctominance element:

< Ex> $ policy = new WSPolicy (array ('useUsernameToken' = & gt; true)); $ Security = new WSSecurityToken (array ('user' = & gt; $ username, 'password type' = & gt; 'plain text', 'password' = & gt; $ password); $ Client = New WSClient (array ('wsdl' = & gt; $ service_wsdl, 'to' = & gt; $ service_url, 'policy' = & gt; $ policy, 'security token to create WSDL mode in client '= & Gt; $ security,' trace '=> 1)); $ Proxy = $ client- & gt; GetProxy (); $ Proxy-> Ping ();

The requested product looks like this:

  & lt; Soapenv: envelope xmlns: soapenv = "http://schemas.xmlsoap.org/ soap / envelope /" & gt; & Lt; Soapenv: header & gt; & Lt; Wsse: security xmlns: wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" sopenv: should should be level = "1" & Gt; & Lt; / Wsse: Security & gt; & Lt; / Soapenv: Header & gt; & Lt; Soapenv: body & gt; & Lt; Ns1: ping xmlns: ns1 = "http://streamlinedsalestax.org/efile" /> & Lt; / Soapenv: Body & gt; & Lt; / Soapenv: envelope & gt;  

You will notice that the user name element is completely missing.

How about this .. Added 'security' to WSPolicy

 < Code> & lt; Php $ policy = new WSPolicy (array ('security' = & gt; array ('useUsernameToken' = & gt;)); $ Security = new WSSecurityToken (array ('user' = & gt; $ username, 'password type' = & gt; 'plain text', 'password' = & gt; $ password); $ Client = New WSClient (array ('wsdl' = & gt; $ service_wsdl, 'to' = & gt; $ service_url, 'policy' = & gt; $ policy, 'security token to create WSDL mode in client '= & Gt; $ security,' trace '=> 1)); $ Proxy = $ client- & gt; GetProxy (); $ Proxy-> Ping ();  

Comments