Sono nuovo di Golang e Soap e ho problemi nell'analisi del sapone msg.Come analizzare Soap Envelope in Golang?
1.I hanno un messaggio SOAP
<?xml version="1.0" encoding="UTF-8"?>
<soap: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:Body>
<activationPack_completeResponse"http://tempuri.org/">
<activationPack_completeResult xsi:type="xsd:string">Active</activationPack_completeResult>
</activationPack_completeResponse>
</soap:Body>
</soap:Envelope>
Ora come non li ho Unmarshal in golang quella che dovrebbe essere la mia dichiarazione di struct per tag Soap busta.
ho qualche struttura come di seguito:
type MyRespEnvelope struct {
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Envelope"`
Soap *Body
}
type Body struct {
XMLName xml.Name `xml:"http://schemas.xmlsoap.org/soap/envelope/ Body"`
GetResponse *ActivationPack_CompleteResponse
}
type ActivationPack_CompleteResponse struct {
XMLName xml.Name `xml:"activationPack_completeResponse"`
Id string `xml:"xmlns,attr"`
MyVar string `xml:"activationPack_completeResult"`
}
Ma sto errore ottenendo come di seguito:
error: expected element <Envelope> in name space http://schemas.xmlsoap.org/soap/envelope/ but have soap*stopped,reason="end-stepping-range",frame={addr="0x0000000000401211",func="main.UnmarshalFirstDitto",args=[{name="data",value="\"\\nNotice: Undefined variable: area in /var/www/nusoap/dittotv.php on line 25\\n\\nNotice: Undefined variable: area in /var/www/nusoap/dittotv.php on line 27\\n\\nNotice: Undefined variable: area in /var/www/nu\"..."}],file="/media/winshare/Golang/WorkSpace/src/DittoTv/ditto.go",fullname="/media/winshare/Golang/WorkSpace/src/DittoTv/ditto.go",line="60"},thread-id="1",stopped-threads="all",core="0"
Quindi, per favore qualcuno mi dica come devo dichiaro la mia struttura in modo che io sono in grado di analizzare il messaggio di sapone.
Sei sicuro che il documento che stai cercando di analizzare sia in realtà XML? Il messaggio di errore fa sembrare che tu stia cercando di analizzare un errore (non XML) da uno script PHP –
@JamesHenstridge Sì, lo sono. Ma per quanto ne so, quale campo ti fa sentire che php sta restituendo l'errore – user2383973
Parte dell'errore legge 'args = [{name =" data ", value =" \ "\\ nNota: Variabile non definita: area in/var/www/nusoap/dittotv.php on line 25 \\ n ... ' –