VMware {code} Community
tbeboreus
Contributor
Contributor
Jump to solution

Unexpected element tag "SOAP-ENV:Envelope" seen

Hi,

we get this error message on every request we are trying to send via gSOAP:

Unexpected element tag "SOAP-ENV:Envelope" seen

Could anyone explain me, why i get this error?

Here is the request:

POST /sdk HTTP/1.1
Host: vmware-test.boreus.de
User-Agent: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="urn:vim25/5.0"
Content-Length: 551
Connection: close
Accept-Encoding: gzip, deflate
SOAPAction: "urn:vim25/5.0"

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope

    xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:vim25"><SOAP-ENV:Body>

<ns1:RetrieveServiceContent xsi:type="ns1:RetrieveServiceContentRequestType">

<ns1:_this xsi:type="ns1:ManagedObjectReference" type="ServiceInstance">ServiceInstance</ns1:_this>

</ns1:RetrieveServiceContent>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

And here the answer:

HTTP/1.1 500 Internal Server Error
Date: Wed, 7 Sep 2011 16:51:10 GMT
Set-Cookie: vmware_soap_session="524dac01-d304-ac9d-c557-34839dde76ac"; Path=/; HttpOnly;
Cache-Control: no-cache
Connection: close
Content-Type: text/xml; charset=utf-8
Content-Length: 565

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
  <faultcode>ClientFaultCode</faultcode>
  <faultstring>
Unexpected element tag &quot;SOAP-ENV:Envelope&quot; seen

while parsing HTTP request before method was determined
at line 1, column 0</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

0 Kudos
1 Solution

Accepted Solutions
stumpr
Virtuoso
Virtuoso
Jump to solution

I'm not really sure if that's the reason either, but it was the first thing that came to mind.  I haven't seen that error, but I'll admit I do not do a lot of gsoap work.

Reuben Stump | http://www.virtuin.com | @ReubenStump

View solution in original post

0 Kudos
11 Replies
stumpr
Virtuoso
Virtuoso
Jump to solution

I'm not really sure of the support of SOAP 1.2 vs 1.1 namespace and encodings, but your client seems to be using 1.2.  I believe the default is for soap2cpp to use 1.1, unless you specify 1.2 (with "-2" as a parameter).  Perhaps rebuilding your project with explicit 1.1 as an option will resolve the issue.

Reuben Stump | http://www.virtuin.com | @ReubenStump
tbeboreus
Contributor
Contributor
Jump to solution

Default is SOAP 1.2 for gSOAP in the current versions. I'll give it a try with -1 als flag.

But i have found some SOAP 1.2 Messages even here in different posts. So i didn't thought it could be the protocol version.

0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

I'm not really sure if that's the reason either, but it was the first thing that came to mind.  I haven't seen that error, but I'll admit I do not do a lot of gsoap work.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
tbeboreus
Contributor
Contributor
Jump to solution

Thank you. Regenerated the source with "-1" and the communication works.

0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

Interesting.  I never ran into that before.  Do you know what version of gSoap started defaulting to v1.2 for SOAP?

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
tbeboreus
Contributor
Contributor
Jump to solution

I didn't find the starting version for this bevahvior.

But here is an interessting part from the gSOAP Docs:

gSOAP supports SOAP 1.1 by default. SOAP 1.2 support is automatically  turned on when the appropriate SOAP 1.2 namespace is used, which shows  up in the namespace mapping table.

0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

Interesting.  So you made a custom namespace table with the 1.2 namespace included and it turned on 1.2 support?

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
ramk2011
Contributor
Contributor
Jump to solution

anyone have idea about the supporting namespace & urn of esxi5.0?

0 Kudos
tos2k
Expert
Expert
Jump to solution

VMware, please help us on this issue, I get reported lots of them...

System.Web.Services.Protocols.SoapException:
Required parameter path is missing
while parsing call information for method FindByDatastorePath
at line 1, column 218
while parsing SOAP body
at line 1, column 207
while parsing SOAP envelope
at line 1, column 38
while parsing HTTP request for method findByDatastorePath
on object of type vim.SearchIndex
at line 1, column 0
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

System.Web.Services.Protocols.SoapException:
Got <spec> tag when expecting <_this> tag
while parsing call information for method ReconfigVM_Task
at line 1, column 218
while parsing SOAP body
at line 1, column 207
while parsing SOAP envelope
at line 1, column 38
while parsing HTTP request for method reconfigure
on object of type vim.VirtualMachine
at line 1, column 0
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

Need help, ESX ESXi 5.0.0 build-474610, specific for some customer environements. Maybe it does not apply for the previous build VMware ESXi 5.0.0 build-469512 ???

TIA

0 Kudos
dude1382
Contributor
Contributor
Jump to solution

I am facing a similar issue with ESX 5.0 host, the same peice of code used to work fine for ESX 4.1.

I'm using open source library libvirt to issue calls to ESX host and for call "ParseDescriptor and createImportSpec", I get errors like:

----------------------------

internal error HTTP response code 500 for call to 'ParseDescriptor'. Fault: ServerFaultCode -
Unexpected element tag "Envelope" seen

while parsing serialized value of type string
at line 8, column 134

while parsing call information for method ParseDescriptor
at line 8, column 0

while parsing SOAP body
at line 7, column 0

while parsing SOAP envelope
at line 2, column 0

while parsing HTTP request for method parseDescriptor
on object of type vim.OvfManager
at line 1, column 0


-----------------------------

Do anyone have any idea how I can make it work, as library prepares custom soap messages (using libxml) and does not use any gSOAP to prepare SOAP messages.

Thanks for your support !

0 Kudos
dude1382
Contributor
Contributor
Jump to solution

I have been able to find the above issue; xml tags needs to be escaped.

Thanks!

0 Kudos