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 Process Server (WID/WPS/WAS+) » MQ Bindings (Export) - Parsing simple XMLs

Post new topic  Reply to topic
 MQ Bindings (Export) - Parsing simple XMLs « View previous topic :: View next topic » 
Author Message
dotaneli
PostPosted: Thu Jun 26, 2008 7:20 am    Post subject: MQ Bindings (Export) - Parsing simple XMLs Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

Hey everyone.

I have created a simple MQ Example program to demonstrate the abilities of WESB regarding MQ.

The program has an interface called MQExampleInterface, which has 3 2-way operations:

opString - gets a string, returns a string
opXML - gets a string, returns XML structure of type MQExampleParentObject
opXMLFull - gets an XML (MQExampleParentObject) and returns an xml
(MQExampleParentObject)

The first 2 operations work perfect.
The 3rd one is the tricky one. When i put an MQ message, it is crucial that i specify this header:

<MQExampleParentObject xsi:type="MQExampleParentObject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://MQExample">

when i specify it, and put the following xml, the operation succeeds:
<?xml version="1.0" encoding="UTF-8"?>
<MQExampleParentObject xsi:type="MQExampleParentObject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://MQExample">
<name>eli</name>
</MQExampleParentObject>

however, when i try something like:
<?xml version="1.0" encoding="UTF-8"?>
<MQExampleParentObject>
<name>eli</name>
</MQExampleParentObject>

the parsing fails.

So i have 2 questions for you
1. How do i take a string input, already in SMO, and convert it to XML, assuming it is an XML?
2. why are the fields, besides the tag itself, required? Can't i get a simple XML structure with no schema reference? (let it use the xsd created once i created the MQExampleParentObject BO).

Any help would be appreciated.

Thanks,

Eli.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Jun 26, 2008 10:46 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

dotaneli wrote:
<?xml version="1.0" encoding="UTF-8"?>
<MQExampleParentObject>
<name>eli</name>
</MQExampleParentObject>


The parsing fails because you do not have the namespaces defined.
you would need to do something like (to be taken with a grain of salt as I am no XML expert)
<?xml version="1.0" encoding="UTF-8"?>
<MQExampleParentObject xsi:type="MQExampleParentObject" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xmlns="http://MQExample" >
<name>eli</name>
</MQExampleParentObject>

This defines the XML to be in the default namespace MQExample and defines the type of the message to be MQExampleParentObject

The rest are just namespace declarations (you can't say xsi:type without defining xsi...

Your parser is looking for something to conform to the namespace it is expecting and what you sent had no namespace definitions at all.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
dotaneli
PostPosted: Sat Jun 28, 2008 10:10 pm    Post subject: Reply with quote

Voyager

Joined: 19 Oct 2005
Posts: 99
Location: Israel

Thank you very much..
It works just fine with the name space supplied.
However it puzzles me... what happens if i don't want the consumer of the service to supply me with that namespace header? And say i do want to export it with BO and not a simple string to manipulate after wards...
Back to top
View user's profile Send private message
dhilton
PostPosted: Fri Aug 22, 2008 1:04 pm    Post subject: Reply with quote

Newbie

Joined: 22 Aug 2008
Posts: 1
Location: Pennsylvania USA

Is it possible to take an XML in without the namespace being specified and have it bound to the BO automatically?
Back to top
View user's profile Send private message
Paul D
PostPosted: Wed Sep 10, 2008 6:44 pm    Post subject: Reply with quote

Master

Joined: 16 May 2001
Posts: 200
Location: Green Bay Packer Country

I have that same issue, an inbound XML without any namespaces and I'd like it bound to the BO automatically. Any ideas on this? Thanks!!!
_________________
Thanks!!!

Paul D
Back to top
View user's profile Send private message Visit poster's website
upcominggeek
PostPosted: Thu Oct 16, 2008 9:06 am    Post subject: Reply with quote

Apprentice

Joined: 21 Aug 2006
Posts: 35
Location: Boston, US

Yes, it is possible. We have done that in our project. We removed the namespace from the BusinessObject and then WPS doesn't look for the namespace. Also, we turned off the validation for the input message while setting QoS params.
Back to top
View user's profile Send private message
Paul D
PostPosted: Mon Oct 20, 2008 12:55 pm    Post subject: Reply with quote

Master

Joined: 16 May 2001
Posts: 200
Location: Green Bay Packer Country

I've recieved some other guidance on this topic from IBM. I'll do some testing and report back to the thread on anything new I learn that has not been covered here yet.
_________________
Thanks!!!

Paul D
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 Process Server (WID/WPS/WAS+) » MQ Bindings (Export) - Parsing simple XMLs
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.