Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: 1 - Unexpected event, expected end-tag #45

Open
lego12239 opened this issue Aug 21, 2015 · 8 comments
Open

error: 1 - Unexpected event, expected end-tag #45

lego12239 opened this issue Aug 21, 2015 · 8 comments

Comments

@lego12239
Copy link

Hi.

Got the next error:

{error,{decoding,[{exception,{error,{"1 - Unexpected event, expected end-tag"}}},
                  {stack,['soap:detail','soap:Fault','soap:Body',
                          'soap:Envelope']},
                  {received,{characters,"Invalid login/pass"}}]}}

while processing the next soap xml response:

<?xml version="1.0" encoding="UTF-8"?>
  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="urn://pmtv.digisoft.com/systemstatus/schema/v0.1" xmlns:ns3="urn://pmtv.digisoft.com/providerstatus/schema/v0.1" xmlns:ns5="http://schemas.microsoft.com/Message" xmlns:ns4="urn://pmtv.digisoft.com/uploadUsageRecords/wsdl/v0.1" xmlns:ns7="ws.kitd.vx2.ws.EntityNotification/EntityNotificationServiceSoap" xmlns:ns6="ws.kitd.vx2.ws.EntityNotification" xmlns:ns8="ws.kitd.vx2.ws.EntityNotification/EntityNotificationServiceSoap12" xmlns:ns11="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns12="http://schemas.datacontract.org/2004/07/GMCS.PMT.IntegrationInternal" xmlns:ns15="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns16="http://schemas.datacontract.org/2004/07/GMCS.PMT.IntegrationInternal" xmlns:ns9="http://GMCS/PMT/Integration" xmlns:lbapi="urn:api3">
    <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
        <faultcode>SOAP-ENV:Server</faultcode>
        <faultstring>error_request</faultstring>
        <detail>Invalid login/pass</detail>
      </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

If i add the next line:

error_logger:info_msg("~p~n~p~n", [Event, ElementRecord]),

near 444 line of erlsom_parse.erl (before a throw call), i get the next output:

{characters,"Invalid login/pass"}
{'soap:detail',[],undefined}

How can i eliminate this error?

Thanks.

@willemdj
Copy link
Owner

Hello Oleg,

The reason for the error is that erlsom expects one or more elements as
children of the tag, and not a text value.

The soap schema says:

<xs:complexType name="detail">
xs:sequence
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"
processContents="lax" />
/xs:sequence
<xs:anyAttribute namespace="##any" processContents="lax" />
/xs:complexType

So a valid error could look like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/
">
SOAP-ENV:Header/SOAP-ENV:Body
SOAP-ENV:FaultSOAP-ENV:Client
Message does not have necessary info
http://gizmos.com/order

<PO:order xmlns:PO="http://gizmos.com/orders/">
Quantity element does not have a value/PO:order
<PO:confirmation xmlns:PO="http://gizmos.com/confirm">
Incomplete address: no zip code/PO:confirmation
/SOAP-ENV:Fault
/SOAP-ENV:Body/SOAP-ENV:Envelope

Regards,
Willem

On Fri, Aug 21, 2015 at 5:05 PM, Oleg notifications@github.com wrote:

Hi.

Got the next error:

{error,{decoding,[{exception,{error,{"1 - Unexpected event, expected end-tag"}}},
{stack,['soap:detail','soap:Fault','soap:Body',
'soap:Envelope']},
{received,{characters,"Invalid login/pass"}}]}}

while processing the next soap xml response:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns2="urn://pmtv.digisoft.com/systemstatus/schema/v0.1" xmlns:ns3="urn://pmtv.digisoft.com/providerstatus/schema/v0.1" xmlns:ns5="http://schemas.microsoft.com/Message" xmlns:ns4="urn://pmtv.digisoft.com/uploadUsageRecords/wsdl/v0.1" xmlns:ns7="ws.kitd.vx2.ws.EntityNotification/EntityNotificationServiceSoap" xmlns:ns6="ws.kitd.vx2.ws.EntityNotification" xmlns:ns8="ws.kitd.vx2.ws.EntityNotification/EntityNotificationServiceSoap12" xmlns:ns11="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns12="http://schemas.datacontract.org/2004/07/GMCS.PMT.IntegrationInternal" xmlns:ns15="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns16="http://schemas.datacontract.org/2004/07/GMCS.PMT.IntegrationInternal" xmlns:ns9="http://GMCS/PM
T/Integration" xmlns:lbapi="urn:api3">
SOAP-ENV:Body
SOAP-ENV:Fault
SOAP-ENV:Server
error_request
Invalid login/pass
/SOAP-ENV:Fault
/SOAP-ENV:Body
/SOAP-ENV:Envelope

If i add the next line:

error_logger:info_msg("pnpn", [Event, ElementRecord]),

near 444 line of erlsom_parse.erl (before a throw call), i get the next
output:

{characters,"Invalid login/pass"}
{'soap:detail',[],undefined}

How can i eliminate this error?

Thanks.


Reply to this email directly or view it on GitHub
#45.

@lego12239
Copy link
Author

Thanks for the reply.

This is bad news, because i can't change a server side code. How can i say erlsom to accept the existent wrong format of detail element?

@willemdj
Copy link
Owner

You can change the schema, so that is an element of type string.
(If you also get "correct" faults it becomes a bit more complicated.)

On Fri, Aug 21, 2015 at 8:16 PM, Oleg notifications@github.com wrote:

Thanks for the reply.

This is bad news, because i can't change a server side code. How can i say
erlsom to accept the existent wrong format of detail element?


Reply to this email directly or view it on GitHub
#45 (comment).

@lego12239
Copy link
Author

If i'll replace here:

  <xs:element name="Fault" type="tns:Fault" />
  <xs:complexType name="Fault" final="extension" >
    <xs:annotation>
          <xs:documentation>
            Fault reporting structure
          </xs:documentation>
        </xs:annotation>
    <xs:sequence>
      <xs:element name="faultcode" type="xs:QName" />
      <xs:element name="faultstring" type="xs:string" />
      <xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
      <xs:element name="detail" type="tns:detail" minOccurs="0" />      
    </xs:sequence>
  </xs:complexType>

the line:

<xs:element name="detail" type="tns:detail" minOccurs="0" />

with:

<xs:any minOccurs="0"/>

Will erlsom parse both correct and incorrect result?

@willemdj
Copy link
Owner

That sounds like a good idea, give it a try.

On Sat, Aug 22, 2015 at 9:31 AM, Oleg notifications@github.com wrote:

If i'll replace here:

<xs:element name="Fault" type="tns:Fault" />
<xs:complexType name="Fault" final="extension" >
xs:annotation
xs:documentation
Fault reporting structure
/xs:documentation
/xs:annotation
xs:sequence
<xs:element name="faultcode" type="xs:QName" />
<xs:element name="faultstring" type="xs:string" />
<xs:element name="faultactor" type="xs:anyURI" minOccurs="0" />
<xs:element name="detail" type="tns:detail" minOccurs="0" />
/xs:sequence
/xs:complexType

the line:

<xs:element name="detail" type="tns:detail" minOccurs="0" />

with:

<xs:any minOccurs="0"/>

Will erlsom parse both correct and incorrect result?


Reply to this email directly or view it on GitHub
#45 (comment).

@lego12239
Copy link
Author

The results of my experiment:

with:

<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />

i get:

    {'soap:Fault',[],
                  {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                         "SOAP-ENV","soap"},
                  "error_request",undefined,undefined}}

with:

<xs:element name="detail" type="xs:string" minOccurs="0"/>

i get:

    {'soap:Fault',[],
                  {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                         "SOAP-ENV","soap"},
                  "error_request",undefined,"Invalid login/pass"}}

So, it seems i can't use any element in place of detail element or i do something wrong.

@willemdj
Copy link
Owner

You are right: if you just need to be able to parse the answer without
getting an error, using "any" works, but if you need the information in the
element it doesn't. (It would be nice to make a change in erlsom
so that "any" elements are included in the result in some generic form,
that should not be so hard.)

What you might also try is to make the element of type "mixed"
(mixed="true").

Good luck,
Willem

On Sun, Aug 23, 2015 at 2:30 PM, Oleg notifications@github.com wrote:

The results of my experiment:

with:

<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />

i get:

{'soap:Fault',[],
              {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                     "SOAP-ENV","soap"},
              "error_request",undefined,undefined}}

with:

<xs:element name="detail" type="xs:string" minOccurs="0"/>

i get:

{'soap:Fault',[],
              {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                     "SOAP-ENV","soap"},
              "error_request",undefined,"Invalid login/pass"}}

So, it seems i can't use any element in place of detail element or i do
something wrong.


Reply to this email directly or view it on GitHub
#45 (comment).

@lego12239
Copy link
Author

So, with:

<xs:element name="detail" type="tns:detail" minOccurs="0" />

and with mixed="true" i get:

{ok,{'soap:Fault',[],
                  {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                         "SOAP-ENV","soap"},
                  "error_auth",undefined,
                  {'soap:detail',[],["Client not authorized"]}}}

and with:

<xs:element name="detail" type="xs:string" minOccurs="0" />

and without mixed="true" i get:

{ok,{'soap:Fault',[],
                  {qname,"http://schemas.xmlsoap.org/soap/envelope/","Server",
                         "SOAP-ENV","soap"},
                  "error_auth",undefined,"Client not authorized"}}

With mixed="true" the result looks more complicated, but it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants