Author |
Message
|
madi |
Posted: Wed Oct 04, 2006 2:26 pm Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
here is what im trying to do
input:
Code: |
<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">
<SOAP-ENV:Body>
<m:data1 xmlns:m="http://www.boom.com" version="1.0">
<m:Num>String</m:Num>
</m:data1>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
|
output:
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<data1 version="1.0" xmlns="http://www.boom.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.boom.com
D:\Data\schemas\schema.xsd" >
<Num>String</Num>
</data1> |
Now if i strip the namespaces of the whole body then its not allowing me to add the new namespaces for the parent element saying that
Quote: |
( WBRK6_DEFAULT_BROKER.default ) Element must have a namespace specified if there is a default namespace in scope.
Whilst writing the XMLNS message, element 'data1' was found to be in scope of a default namespace, but this element does not have a namespace defined. |
plz help
--madi |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Oct 04, 2006 8:40 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi madi,
Ok, I did not read the entire post, so I could be missing out on something.
madi wrote: |
Now if i strip the namespaces of the whole body then its not allowing me to add the new namespaces for the parent element saying that
Quote: |
( WBRK6_DEFAULT_BROKER.default ) Element must have a namespace specified if there is a default namespace in scope.
Whilst writing the XMLNS message, element 'data1' was found to be in scope of a default namespace, but this element does not have a namespace defined. |
|
What is the message that you are sending after " i strip the namespaces of the whole body"...could you paste that...
Do u have a default namespace defined in it ? If you do, then you can only reference every element in it using that namespace...in other words, atleast in the esql, you will need to use a namespace prefix...
Please paste your message and code.
Regards. |
|
Back to top |
|
 |
madi |
Posted: Thu Oct 05, 2006 6:33 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
so here is my code
Code: |
SET OutputRoot.XMLNS.data1= InputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.m:data1;
DECLARE Ref_OutputRoot REFERENCE TO OutputRoot.XMLNS.data1;
CALL StripNamespaces(Ref_OutputRoot);
|
next compute node
Code: |
SET OutputRoot.XMLNS.data1.(XML.NamespaceDecl)xmlns = 'http://www.boom.com';
SET OutputRoot.XMLNS.data1.(XML.NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNS.data1.(XML.NamespaceDecl)xsi:SchemaLocation='schema.xsd';
SET OutputRoot.XMLNS.data1= InputRoot.XMLNS.data1;
|
i have the code in the second part before and it worked just fine
its not working when we strip the namespace prefixes
i don't want to have any namespace prefixes,like NS1: or SOAP-ENV:, just a namespace like
Quote: |
<data1 version="1.0" xmlns="http://www.boom.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.boom.com
D:\Data\schemas\schema.xsd" >
<Num>String</Num>
</data1> |
does that make sense??
thanks
madi |
|
Back to top |
|
 |
madi |
Posted: Thu Oct 05, 2006 10:28 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
trace before the output node where i get the error
Quote: |
(0x01000000):data1= (
(0x07000012):xmlns = 'http://www.boom.com'
(0x07000012)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x07000012)http://www.w3.org/2001/XMLSchema-instance:schemaLocation = 'http://www.boom.com D:\Data\schemas\schema.xsd'
(0x01000000):Num = (
(0x02000000): = 'String' |
hope someone has ideas!!
--madi |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 05, 2006 11:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Hi madi,
you said:
Quote: |
I used the procedure given above to strip the namespaces out from SOAP:Body |
...and that's your mistake. This is much simpler than you think. All you are doing is changing the namespace prefix for namespace URI http://www.boom.com. You happen to be changing it to the empty string. You are not changing the namespace of anything. The only thing you need to do is change ( in the message tree ) the xmlns attribute which sets that prefix. From the code you posted, it looks as if you are already doing that. So just remove the call to StripNamespaces and everything should start working.
...I hope  |
|
Back to top |
|
 |
madi |
Posted: Mon Oct 09, 2006 8:12 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
Quote: |
(0x01000000):XMLNSC = (
(0x01000000):data1= (
(0x03000102):m = 'http://www.boom.com'
(0x03000000):Id = 'String'
(0x03000000):Code = 'St' |
Hi All
the strip namespace procedure is not getting rid of the m namespace prefix
the above message is after it went through the procedure
i added 0x03000102 to the IN list but still no result
do i have to do anything else??
Thanks
madi |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Oct 09, 2006 9:43 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi madi,
You will have to show us the code for the Strip namespace...also the input that is going to the procedure and the output that u require.
Also, do u want a default namespace ?(from your previous post) The default namespace is a namespace for all the elements below...in other words, ur only removing the namespace visibly but not logically.
Regards. |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Tue Oct 10, 2006 4:41 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
I think you need to remove the namespace declarations/attributes before you call stripNamespaces(). Then you should be able to do whatever in the next compute node. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 10, 2006 5:34 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
I think everybody posting on this thread needs to re-read the entire thread before posting anything else!
elvis : the code for StripNamespaces is included earlier in this thread.
special_agent_Queue : StripNamespaces walks the entire tree. As I said earlier in this thread, it ought to remove xmlns attributes as it goes.
madi: Not sure why you have changed your mind about my post on 5th October. Unless your requirements have changed, you don't need to call StripNamespaces at all. You just need to change the xmlns attribute which defines the prefix for http://www.boom.com.
To all readers of this thread: I advise caution if you copy the code for StripNamespaces as posted in this thread. It contains a defect which means that it will not process every node in the message tree. |
|
Back to top |
|
 |
special_agent_Queue |
Posted: Tue Oct 10, 2006 7:41 am Post subject: |
|
|
 Centurion
Joined: 27 Jul 2006 Posts: 102
|
Quote: |
i have the code in the second part before and it worked just fine
its not working when we strip the namespace prefixes
|
Then why do you need to strip the namespaces? If it worked before, I'd leave it alone. Kimbert's advice appears to be correct.
kimbert: I'm using the code as posted, and I thought I remembered having to remove some of the declarations beforehand. Might I ask what the defect is?
Thanks. |
|
Back to top |
|
 |
madi |
Posted: Tue Oct 10, 2006 9:14 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
OK
There are two types of SOAP messages I am dealing with.
1:
Quote: |
<SOAPENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAPENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAPENV:Body>
<m:data1xmlns:m="http://www.boom.com" >
<m:Id>String</m:Id>
<m:Code>St</m:Code>
</m:data1>
</SOAPENV:Body>
</SOAPENV:Envelope>
|
2.
Quote: |
<SOAPENV:Envelope xmlns:SOAPENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAPENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAPENV:Body>
<m:data1xmlns:m="http://www.boom.com" >
<Id>String</Id>
<Code>St</Code>
</m:data1>
</SOAPENV:Body>
</SOAPENV:Envelope> |
Now, if you havent noticed the dfference, the first message Body has namespace prefixes for both the parent and the elements but the second message body has only prefix for the parent but not for its elements
I am trying to validate the pay load using the xml validator which needs just the pay load to validate against the schema.
In the first message, the validation passes if we just copy the Body to the outputRoot before we send to the validator
But in the second case, the pay load does not validate against its schema
if we just pass the Body along
so the solution for the second is to strip the namespaces and then send the Body to the validator which then validates the message(as valid)
so thats the logic behind the start of this discussion
as always I appretiate all your help
thanks
madi |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 10, 2006 12:46 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Quote: |
so the solution for the second is to strip the namespaces and then send the Body to the validator |
Hmmmm. I'm not at all convinced.
Quote: |
In the first message, the validation passes if we just copy the Body to the outputRoot before we send to the validator
|
If that's true, your schema must declare elements Id and Code to be in namespace http://www.boom.com.
Quote: |
so the solution for the second is to strip the namespaces and then send the Body to the validator which then validates the message(as valid) |
Wrong. You now have a document in which Id and Code are in noTargetNamespace, but the schema expects them to be in http://www.boom.com. The document will fail validation unless your schema is very badly designed.
You need to be very clear about the distinction between namespaces and namespace prefixes. An element without a prefix might belong to a namespace. Two elements with different prefixes might belong to the same namespace. For this reason, when describing XML docs, it's safer to talk about which namespace an element belongs to, rather than saying what prefix it has. |
|
Back to top |
|
 |
madi |
Posted: Tue Oct 10, 2006 2:29 pm Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
i agree that the schema is very badly designed but that os what I was given and so i had to find a way to make it work !!!
i will give more thought to this and will reply once i decide if I want to redesign the schema to include everything in a namespace or just leave it the way it is and go to my next assignment
thanks
madi |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 11, 2006 12:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Quote: |
i agree that the schema is very badly designed but that os what I was given and so i had to find a way to make it work !!! |
I never claimed that it was. I was just trying to make sense of the information that you were giving out.
Quote: |
i will give more thought to this |
Good idea.  |
|
Back to top |
|
 |
|