php - SOAP encoding Problems -


O people, I just started learning soap and I got a problem when I expected to get an integer and when I I'm hoping to get a string or array or JSN, error is:

SOAP-ERROR: encoding: violation of encoding rules

I I have seen all the answers about this and it is not helping me

My code is:

  & lt ;? Xml version = '1.0' encoding =  

'UTF-8'? & Gt; & Lt; Definitions name = 'name' targetname = 'http: // localhost / soap' xmlns: tns = 'http: // localhost / soap' xmlns: soap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns: xsd = 'http: //www.w3.org/2001/XMLSchema' xmlns: सोপनेक = 'http: //schemas.xmlsoap.org/soap/encoding/' xmlns: wsdl = 'http: // schemas Xmlsoap.org/wsdl/ 'xmlns =' http: //schemas.xmlsoap.org/wsdl/'> & Lt; Message Name = "getNamesRequest" & gt; & Lt; part name = "num" type = "xsd: string" /> & Lt; / Messages & gt; & Lt; Message Name = "Friendly Response" & gt; & Lt; Part name = "result" type = "xsd: string" /> & Lt; / Messages & gt; & Lt; PortType name = "NamesPortType" & gt; & Lt; Operation name = "get-name" & gt; & Lt; Input message = "tns: getNamesRequest" /> & Lt; Output message = "tns: getNamesResponse" /> & Lt; / Operation & gt; & Lt; / PortType & gt; & Lt; Compulsory name = "namebinding" type = "TNS: name striptype" & gt; & Lt; Soap: Binding style = "RPC" transport = "http://schemas.xmlsoap.org/soap/http" /> & Lt; Operation name = "get-name" /> & Lt; / Binding & gt; & Lt; Service name = "name service" & gt; & Lt; PortName = "Memorandum" binding = "TNS: nomination" & gt; & Lt; Soaps: address space = "http: //localhost/soap/server.php" /> & Lt; / Port & gt; & Lt; / Services & gt; & Lt; / Definitions & gt;

server.php

  & lt ;? Php function getNames ($ num) {$ name = $ num; Return $ name; } Ini_set ('soap.wsdl_cache_enabled', '0'); $ Server = new SOAP server ("http: //localhost/soap/names.wsdl"); $ Server & gt; addFunction ("getNames"); $ Server & gt; take care ();   

client.php

  & lt ;? Try php {$ client = new SOAP client ('http: // localhost / soap / names.wsdl'); $ Result = $ client- & gt; Milenama ('winner'); Return results $; } Hold (easyfault $ e) {ebay $ e-> getMessage (); }    

Please direct your server and customer to UTF-8 Encoding:

  $ server = New SOAP server ('http: //localhost/soap/names.wsdl', array ('encoding' => 'UTF-8 ')); $ Client = new SOAP client ('http: //localhost/soap/names.wsdl', array ('encoding' = & gt; 'UTF-8'));    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -