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

How to generate a soap fault? #23

Closed
mdaguete opened this issue Nov 3, 2009 · 1 comment
Closed

How to generate a soap fault? #23

mdaguete opened this issue Nov 3, 2009 · 1 comment

Comments

@mdaguete
Copy link
Contributor

mdaguete commented Nov 3, 2009

Hello,

I'm trying to generate a soap fault from a yaws soap endpoint, what's the correct return from handle function ?

I'm trying with:
{error,undefined,
#'soap:Fault'{
anyAttribs = [],
faultcode = "error",
faultstring = Error
}
}
But yaws_soap_srv prints :
yaws_soap_srv(239): Srv Error: "Error processing message: {error,undefined,\n {'soap:Fault',[],"error","econnrefused",\n undefined,undefined}}"

Any idea ?

Thanks. Regards.

@vinoski
Copy link
Collaborator

vinoski commented Nov 3, 2009

The following is from Willem de Jong, the primary contributor of the Yaws SOAP support.

Unfortunately this is not as easy as it should be. One of the problems is the fact that the faultcode element has to be a qualified name. It might for example look like this:

<soap:Fault>
    <faultcode>soap:Server</faultcode>
...

Note that the soap: in the value has to match the prefix of a declared namespace, and the declaration of namespaces is something that is kind of hard to control (it is something that you would typically like your libraries to take care of).

You could try to do this (using some undocumented erlsom support for qualified names):

Fault = #'soap:Fault'{
    faultcode = {qname, "http://schemas.xmlsoap.org/soap/envelope/",
                        "soap", "Server", undefined},
    faultstring = Error},
{ok, undefined, Fault, 500, undefined}

Note that I used ok instead of error, and that I used a tuple with 5 elements in order to be able to specify the result code (500).

Alternatively, you can have a look at the result() function in yaws_soap_srv.erl and the makeFault() function in yaws_soap_lib.erl, and adapt these to your needs. That should be relatively straightforward.

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