Ciao a tutti.
Ho un po' di confusione in testa a proposito di webservice (ws). Devo collegarmi a un ws tramite pagina ASP e inviare dei dati, ma non sono certo che il procedimento che seguo sia quello corretto. Di seguito vi riporto il codice che ho scritto. Nello specifico funziona, il messaggio viene trasmesso e il ws mi restituisce la risposta corretta. Il problema nasce quando le richieste che invio sono più corpose. Praticamente recupero i dati dal mio database per poi inviarli al ws. Se uso un sw ad hoc per il dialogo con i ws, tutto funziona, se uso uno script implementato come quello che segue (cambia sostanzialemente la lunghezza dal messaggio SOAP) il solo risultato che ottengo è uno "Status: 500 - Internal Server Error".
Posso chiedervi cosa non funziona nel codice che segue o cosa può essere fatto diversamente?
<%
' /// ---------------- / SUB / ---------------- ///
private sub sendXMLHttpHeader(strSOAP, strURL)
objXMLHttp.Open "POST", strURL, false
objXMLHttp.setRequestHeader "Host", "test.dominio.it"
objXMLHttp.setRequestHeader "Content-Type", "application/soap+xml; charset=utf-8"
objXMLHttp.setRequestHeader "Content-Length", Len(strSOAP)
objXMLHttp.send (strSOAP)
end sub
' /// ---------------- / INVIO MESSAGGIO SOAP / ---------------- ///
set objXMLHttp = CreateObject("Msxml2.XMLHTTP")
strSOAP = "<?xml version=""1.0"" encoding=""utf-8""?>"
strSOAP = strSOAP & "<soap12:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">"
strSOAP = strSOAP & "<soap12:Body>"
strSOAP = strSOAP & "<SignIn xmlns=""http://schema.dominio.it/"">"
strSOAP = strSOAP & "<username>userPippo</username>"
strSOAP = strSOAP & "<password>pswPippo</password>"
strSOAP = strSOAP & "</SignIn>"
strSOAP = strSOAP & "</soap12:Body>"
strSOAP = strSOAP & "</soap12:Envelope>"
strURL = "http://test.dominio.it:81/partner/services/uploadservice.asmx"
'/// Funzione per l'invio degli header XMLHttp
call sendXMLHttpHeader(strSOAP, strURL)
Response.Write "
Status: " & objXMLHttp.status & " - " & objXMLHttp.statusText
set objXMLHttp = nothing
%>
Vi ringrazio per l'aiuto.
P.S.: date per scontato che i mime che uso e il soap che scrivo siano corretti.
;-)

Rispondi quotando