• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Oracle pl/sql ..... soap api question

css_jay99

Fingers like lightning
Joined
Apr 25, 2006
Messages
746
Likes received
11
Thanks received
2
Hi,

I am trying to extract a value from a soap api request in pl/sql

variable t_response is an xmltype returned from soap api
t_response has the following xml value below

<ns1:wrappedResponse xmlns:ns1 "http://cuk.com/res/cukwebservice/actions/">
<soapStatus xmlns="http://cuk.com/ccuk/schema" success="true"/>
</ns1:wrappedResponse>


I am trying to xtract the value of the attribute success
I tried something like

p_value := t_response.extract('/soapStatus@success','xmlns:ns1="http://cuk.com/ccuk/schema"').getStringVal();

but just kep getting ... ORA-30625: method dispatch on NULL SELF argument is disallowed....

any clues?

css_jay99
 
I had already googled but no luck with the issue since the error code is implying that I am passing null/missing xml to the method which I am not



css_jay99
 
I have absolutely no idea what that even means.
 
Shouldn't that be /soapStatus/@success ?
 
...

<ns1:wrappedResponse xmlns:ns1 "http://cuk.com/res/cukwebservice/actions/">
<soapStatus xmlns="http://cuk.com/ccuk/schema" success="true"/>
</ns1:wrappedResponse>


I am trying to xtract the value of the attribute success
I tried something like

p_value := t_response.extract('/soapStatus@success','xmlns:ns1="http://cuk.com/ccuk/schema"').getStringVal();

but just kep getting ... ORA-30625: method dispatch on NULL SELF argument is disallowed....
...
css_jay99

I think more like

p_value := t_response.extract('/soapStatus@success','xmlns="http://cuk.com/ccuk/schema"').getStringVal();

or

p_value := t_response.extract('/ns1:soapStatus@success','xmlns:ns1="http://cuk.com/ccuk/schema"').getStringVal();

Isn't the soapStatus element in the "http://cuk.com/ccuk/schema" namespace, so you need to either declare that as the default namespace, or actually use the 'ns1' alias you are defining.

Also I'd probably be checking that the result of the extract is not null before calling the getStringVal operation (to avoid the error)

Perhaps...
 
I''ll give that a try when i get into work

cheers

css_jay99
 
Not sure about any obscure xPath synxtax in PL/SQL, as normally it would be '/soapStatus/@success' so can't comment on the way to access the success attribute.

Take a look at http://www.mercatorgeosystems.com/blog/?p=5 which seems to indicate using the '/' before the attribute.

Also, as donkey said, don't mess up your namespaces. Use either '/ns1:soapStatus@success' with a namespace declaration of 'xmlns:ns1="http://cuk.com/ccuk/schema' or drop off the namespace declaration altogether.
 
Last edited: 07:15

Advertisers

Back
Top