ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XMLNSC header building

Post new topic  Reply to topic
 XMLNSC header building « View previous topic :: View next topic » 
Author Message
biswagourab
PostPosted: Fri Apr 11, 2008 9:15 am    Post subject: XMLNSC header building Reply with quote

Apprentice

Joined: 31 May 2005
Posts: 47
Location: London

Hi
Can anyone please tell me how to build the following header in ESQL.


<?xml version="1.0" encoding="utf-8" ?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:c="http://www.w3.org/2001/XMLSchema">
<soapenv:Body>

I am trying to generate this ...but am only able to generate this

<?xml version="1.0" encoding="UTF-8"?>
<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">
<NS2:Body xmlns:NS2="http://www.brokersamplewshost.ibm.com">


Thanks in advance.
_________________
_________________
Biswa Gourab Malla
IBM Certified System Administrator - WebSphere MQ, v6.0
IBM Certified System Administrator - Websphere Message Broker v6.0
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
marcin.kasinski
PostPosted: Fri Apr 11, 2008 10:18 am    Post subject: Re: XMLNSC header building Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Check little example code below or other examples or docs:

Code:

   
   DECLARE mySoapNS NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
   DECLARE q0 NAMESPACE 'http://www.server.com.pl/WSPilot/SimpleTypes';
   
   
   CREATE FUNCTION CreateXMLNSSOAP()
   BEGIN
      
      
      DECLARE req REFERENCE TO OutputRoot;
CREATE LASTCHILD OF req DOMAIN('XMLNS') NAME 'XMLNS';
      
      
      -- Add an XML declaration to the message
SET OutputRoot.XMLNS.(XML.XmlDecl) = '';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Version) = '1.0';
SET OutputRoot.XMLNS.(XML.XmlDecl).(XML.Encoding) = 'UTF-8';
-- Create the SOAP Envelope
SET OutputRoot.XMLNS.mySoapNS:Envelope.(XML.NamespaceDecl)xmlns:"SOAP-ENV" =
'http://schemas.xmlsoap.org/soap/envelope/' ;
SET OutputRoot.XMLNS.mySoapNS:Envelope.(XML.NamespaceDecl)xmlns:xsi =
'http://www.w3.org/2001/XMLSchema-instance' ;
SET OutputRoot.XMLNS.mySoapNS:Envelope.(XML.NamespaceDecl)xmlns:q0 = q0 ;
SET OutputRoot.XMLNS.mySoapNS:Envelope.(XML.NamespaceDecl)xmlns:xsd =
   'http://www.w3.org/2001/XMLSchema' ;

SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.q0:addInt.intPair.v1=2;
SET OutputRoot.XMLNS.mySoapNS:Envelope.mySoapNS:Body.q0:addInt.intPair.v1=3;

      
      
   END;

_________________
Marcin


Last edited by marcin.kasinski on Fri Apr 11, 2008 10:20 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Gemz
PostPosted: Fri Apr 11, 2008 10:18 am    Post subject: Reply with quote

Centurion

Joined: 14 Jan 2008
Posts: 124

Can you please post the ESQL that you used to create your output.?

Thanks
Gemz
Back to top
View user's profile Send private message
biswagourab
PostPosted: Mon Apr 14, 2008 3:52 am    Post subject: Reply with quote

Apprentice

Joined: 31 May 2005
Posts: 47
Location: London

Thanks marcin.kasinski
_________________
_________________
Biswa Gourab Malla
IBM Certified System Administrator - WebSphere MQ, v6.0
IBM Certified System Administrator - Websphere Message Broker v6.0
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
paustin_ours
PostPosted: Wed Feb 08, 2012 12:08 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

I know this is a pretty old post but am gonna ask for some help anyway!

here it goes,

As in the initial post, i am still getting NS1 in my output and not able to get a soapenv to appear.

This is expected
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

This is what am getting
<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/"></NS1:Envelope>

My code:

Code:

 CALL CopyMessageHeaders();
      -- CALL CopyEntireMessage();
      CREATE LASTCHILD OF OutputRoot DOMAIN ('XMLNSC') NAME 'XMLNSC';
      
      
   DECLARE mysoapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
SET OutputRoot.XMLNSC.mysoapenv:Envelope.(XML.NamespaceDecl)xmlns:"SOAP-ENV"='http://schemas.xmlsoap.org/soap/envelope/';


not sure what am missing. I am declaring the namespace mysoapenv. I read that NS1 shows up only if a namespace is not declared. Any pointers will be very helpful. Thanks.
Back to top
View user's profile Send private message Yahoo Messenger
adubya
PostPosted: Wed Feb 08, 2012 12:31 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

How about

Code:
SET OutputRoot.XMLNSC.mysoapenv:Envelope.(XML.NamespaceDecl)xmlns:soapenv=mysoapenv;


?
Back to top
View user's profile Send private message Send e-mail
paustin_ours
PostPosted: Wed Feb 08, 2012 1:14 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

Just tried what you had suggested, still the same output, NS1:Envelope
Back to top
View user's profile Send private message Yahoo Messenger
kimbert
PostPosted: Wed Feb 08, 2012 1:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You are getting confused.

This line:
Code:
DECLARE mysoapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
only affects your ESQL. It is almost the same as
Code:
DECLARE mysoapenv CHARACTER 'http://schemas.xmlsoap.org/soap/envelope/';
...except that you can use a NAMESPACE constant in ESQL path references using nice clean syntax. Like this:
Code:
SET OutputRoot.XMLNS.mysoapenv:Envelope.mysoapenv:Header.(XMLNSC.Attribute)mustUnderstand="1";



However...this next line of ESQL does affect the output XML:
Code:
SET OutputRoot.XMLNS.mysoapenv:Envelope.(XML.NamespaceDecl)xmlns:"SOAP-ENV" =
'http://schemas.xmlsoap.org/soap/envelope/' ;

It is adding an xmlns attribute to the output message tree. The XMLNSC writer automatically detects xmlns attributes in the output message tree and it adjusts the namespace prefixes in the output message based on those xmlns attribute.

If you don't understand that last paragraph, then please read this: http://www.w3.org/TR/REC-xml-names/
...or else take the W3Schools tutorial on XML namespaces.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Feb 08, 2012 1:47 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

paustin_ours wrote:
Just tried what you had suggested, still the same output, NS1:Envelope

The XMLNSC parser expects XMLNSC constants:
Code:
...(XMLNSC.NamespaceDecl)...
Back to top
View user's profile Send private message
paustin_ours
PostPosted: Wed Feb 08, 2012 2:16 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

Thanks for catching that rekarm, that did it.

Thanks for the insight kimbert, i definitely need to read more on namespaces. Thanks again for your time guys.
Back to top
View user's profile Send private message Yahoo Messenger
marcin.kasinski
PostPosted: Wed Feb 08, 2012 2:28 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

paustin_ours wrote:
Thanks for catching that rekarm, that did it.

Thanks for the insight kimbert, i definitely need to read more on namespaces. Thanks again for your time guys.


The most important thing is that

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ...>

and

<NS1:Envelope xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/" ...>

is the same object.

soapenv and NS1 is just alias points to namespace "http://schemas.xmlsoap.org/soap/envelope/".


It doesn't matter how you name namespace alias in most cases.
I saw excaptions.
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » XMLNSC header building
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.