amac Posted April 25, 2013 at 02:08 PM Report #504792 Posted April 25, 2013 at 02:08 PM Boa tarde a todos os ilustres membros do forum, actualmente encontro-me a desenvolver um webservice em php usando o Nusoap quando crio um cliente em php, em excel ou em visual basic as funções do webservice funcionam bem, mas tenho um cliente que usa um programa criado em pure basic faz um request em xml e recebe um erro devolvido pelo servidor dizendo "que não existe metodo wsdl definido" este cliente indica-me que usa o mesmo código para comunicar com outros webservices em php e que funciona bem, o qual já confirmei. Desta forma e após várias batalhas para resolução do problema gostaria de saber como fazer log ou debug do pedido feito pelos meus clientes ao meu webservice. Obrigado
HappyHippyHippo Posted April 25, 2013 at 07:45 PM Report #504840 Posted April 25, 2013 at 07:45 PM pergunta ao cliente como está a aceder ao WSDL IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
amac Posted April 26, 2013 at 03:02 PM Author Report #504937 Posted April 26, 2013 at 03:02 PM pergunta ao cliente como está a aceder ao WSDL Actualmente o cliente usa uma biblioteca própria do purebasic COmateplus, faz a chamada do meu servidor http://servidor/server.php?wsdl e depois envia a mensagem SOAP contruida no próprio código
HappyHippyHippo Posted April 26, 2013 at 03:18 PM Report #504940 Posted April 26, 2013 at 03:18 PM é impossível te ajudar com a falta de informação necessária para determinar o que se está a passar IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
amac Posted April 29, 2013 at 11:05 AM Author Report #505158 Posted April 29, 2013 at 11:05 AM Em 4/26/2013 às 16:18, HappyHippyHippo disse: é impossível te ajudar com a falta de informação necessária para determinar o que se está a passar Boas, este é o xml criado pelo cliente **************************************************************Start********************************************* XML + "<?xml version=@1.0@ encoding=@utf-8@?>" XML + "<soap:Envelope xmlns:xsi = @http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd = @http://www.w3.org/2001/XMLSchema' xmlns:soap=@http://schemas.xmlsoap.org/soap/envelope/@>" XML + "<soap:Body>" XML + "<personTransfer xmlns=http://tempuri.org/@>" XML + "<firstName>" + categoria + "</firstName>" XML + "<lastName>" + categoria + "</lastName>" XML + "</personTransfer>" XML + "</soap:Body>" XML + "</soap:Envelope>" XML = ReplaceString(XML, "@", Chr(34)) ExecuteResult = CallWebService(XML, "http://localhost/nusoap/simple_server_teste.php#") 'Função de envio ProcedureDLL.s CallWebService(Input.s, AsmxAddress.s) Define XmlHttp.COMateObject Define ObjXMLDOM.COMateObject Define ReturnValue.i Define RetStringValue.s XmlHttp = COMate_CreateObject("MSXML2.XmlHttp") If XmlHttp XmlHttp\Invoke("Open('POST', '" + AsmxAddress + "', #False)") XmlHttp\Invoke("setRequestHeader('Content-Type', 'application/soap+xml; charset=utf-8')") XmlHttp\Invoke("setRequestHeader('Content-Length', " + Str(Len(Input)) + ")") XmlHttp\Invoke("setRequestHeader('Connection', 'close')") XmlHttp\Invoke("Send('" + ReplaceString(Input, "'", "$0027") + "')") ReturnValue = XmlHttp\GetIntegerProperty("status") RetStringValue = XmlHttp\getStringProperty("responseText") Debug RetStringValue If ReturnValue = 200 ReturnValue = 0 Else ReturnValue = 1 EndIf XmlHttp\Release() Else Debug "!XmlHttp" EndIf ProcedureReturn RetStringValue EndProcedure **************************************************************END********************************************* Este é o erro devolvido ao cliente <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body><SOAP-ENV:Fault><faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode><faultactor xsi:type="xsd:string"></faultactor><faultstring xsi:type="xsd:string">Operation '' is not defined in the WSDL for this service</faultstring><detail xsi:type="xsd:string"></detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
amac Posted April 30, 2013 at 10:16 PM Author Report #505398 Posted April 30, 2013 at 10:16 PM é impossível te ajudar com a falta de informação necessária para determinar o que se está a passar Após o código transmitido no último Post tem alguma sugestão que possa seguir. Obrigado
HappyHippyHippo Posted April 30, 2013 at 10:46 PM Report #505405 Posted April 30, 2013 at 10:46 PM sim tenho (e não é sobre a forma arcaica de criação do XML por parte do cliente ...) sempre tive problemas em obter boas respostas por parte das aplicações .Net em webservices RPC. altera para document se tiveres dúvidas em como fazer isso, apresenta o teu código e eu digo-te o que deverás alterar IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
taviroquai Posted May 2, 2013 at 12:07 AM Report #505548 Posted May 2, 2013 at 12:07 AM Pela mensagem de erro devolvida parece que o cliente nao esta a especificar bem a operação, ou nao esta a especificar da forma correta como o nusoap gosta. 1 Report
amac Posted May 2, 2013 at 12:57 PM Author Report #505580 Posted May 2, 2013 at 12:57 PM (edited) sim tenho (e não é sobre a forma arcaica de criação do XML por parte do cliente ...) sempre tive problemas em obter boas respostas por parte das aplicações .Net em webservices RPC. altera para document se tiveres dúvidas em como fazer isso, apresenta o teu código e eu digo-te o que deverás alterar Alterei o estilo de "RPC" para document tal como especificado na figura // register method: personTransfer $soap_server->register( // method name 'personTransfer', // input args array('person' => 'tns:person'), // output args array('return' => 'tns:person'), // namespace 'uri:'. NUSOAP_NAME_SPACE, // SOAPAction 'uri:'. NUSOAP_NAME_SPACE .'#personTransfer', // style 'document', // use 'literal' ); mas não resolveu até que activei o debug em php e localizei uma diferença, alterei o código cliente e a situação foi resolvida. Verifiquei que a diferença alterada tem a ver com a versão do SOAP. XmlHttp\Invoke("Open('POST', '" + AsmxAddress + "', #False)") ;USAR PARA O SOAP 1.2 ;XmlHttp\Invoke("setRequestHeader('Content-Type', 'application/soap+xml; charset=ISO-8859-1')") ;Usar para a versão SOAP 1.1 XmlHttp\Invoke("setRequestHeader('Content-Type', 'Content-Type: text/xml; charset=ISO-8859-1')") Agora após a tua sugestão de alteração do style do soap de "RPC" para "document" qual a diferença? Qual usar, quando temos várias aplicações desenvolvidas em várias linguagens a consumir o webservice? Edited May 2, 2013 at 12:58 PM by amac
HappyHippyHippo Posted May 2, 2013 at 02:04 PM Report #505587 Posted May 2, 2013 at 02:04 PM http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c018da90-0201-0010-ed85-d714ff7b7019 WSDL 1.1 specifies the style of the binding as either RPC or document. This choice corresponds to how the SOAP payload - i.e., how the contents of the <soap:Body> element - can be structured. Here are some details of how each style affects the contents of <soap:Body>: Document: the content of <soap:Body> is specified by XML Schema defined in the <wsdl:type> section. It does not need to follow specific SOAP conventions. In short, the SOAP message is sent as one "document" in the <soap:Body> element without additional formatting rules having to be considered. Document style is the default choice. RPC: The structure of an RPC style <soap:Body> element needs to comply with the rules specified in detail in Section 7 of the SOAP 1.1 specification. According to these rules, <soap:Body> may contain only one element that is named after the operation, and all parameters must be represented as sub-elements of this wrapper element. As a consequence of the freedom of choice that the document style offers, the SOAP messages conforming to a document style WSDL may look exactly the same as the RPC equivalent. The decisive question now is: What are the consequences of choosing one option or another? Why choose RPC over document, or document over RPC? In many cases, the SOAP messages generated from either RPC or document style WSDLs look exactly the same - so why offer the choice at all? The reason may be found in the history of the SOAP standard. SOAP has its roots in synchronous remote procedure calls over HTTP and the appearance of the document accordingly followed these conventions. Later, it was seen as a simplification to use arbitrary XML in the SOAP body without adhering to conventions. This preference is reflected in the document style WSDL documents. So far, both options are represented in the WSDL specification and the choice of one or the other is mainly a question of personal taste since most SOAP clients today accept both versions. 1 Report IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
amac Posted May 3, 2013 at 06:11 PM Author Report #505750 Posted May 3, 2013 at 06:11 PM http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c018da90-0201-0010-ed85-d714ff7b7019 thk!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now