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 » SOAP Req, Generic WebService - namespace ?

Post new topic  Reply to topic
 SOAP Req, Generic WebService - namespace ? « View previous topic :: View next topic » 
Author Message
sebastia
PostPosted: Thu Mar 20, 2014 12:56 am    Post subject: SOAP Req, Generic WebService - namespace ? Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Hi.
The SOAP Request node has a "operation mode" checkbox. You can either

*) invoke a specific web service defined by a WSDL interface
*) invoke a generic web service

We want to use the second option, also called "gateway mode".

The description says
"Gateway mode allows you to configure your flow to handle generic SOAP request/response and one-way messages, or to act as a facade between multiple web services clients and multiple back-end web services providers. The node can onvoke any binding operation."

Perfect - that is EXACTLY what we need.

Now, how to set destination URL ? No problem :
Code:
SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = newUrl ;


Next - how to set "Operation" ? No problem :
Code:
SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = 'myOperation' ;


Last : what about NAMESPACE ?
My first webservice requires
Code:
declare q0 NAMESPACE 'http://wsServer.myfirst.com/' ;

And the second web service requires
Code:
declare q1 NAMESPACE 'http://tod.ws.com/' ;


How can I change namespaces between different web services ?

Sebastian.
Back to top
View user's profile Send private message Visit poster's website
fatherjack
PostPosted: Thu Mar 20, 2014 3:50 am    Post subject: Re: SOAP Req, Generic WebService - namespace ? Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

sebastia wrote:
Last : what about NAMESPACE ?
My first webservice requires
Code:
declare q0 NAMESPACE 'http://wsServer.myfirst.com/' ;

And the second web service requires
Code:
declare q1 NAMESPACE 'http://tod.ws.com/' ;


How can I change namespaces between different web services ?

Sebastian.


As you have described above? Or am I misunderstanding? What problem are you seeing when you use the node in gateway mode?
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
sebastia
PostPosted: Thu Mar 20, 2014 3:57 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Jajaja - thanks Jack, now I see I did a very bad description.

Let me improve it.

I want to have a TABLE with all the possible web services.
So, I receive a message and by its contents, calculate the index to the table, where someone has stored

*) the destination URL
*) the remote OPERATION.

But looks like I need to setup a "namespace" before going into SOAP Request node.

How can I get the namespace from a table AND SET IT ?

The sentence "declare" is not a run time sentence, but coding time.

I need to change namespace on run time ...

Tx.
Back to top
View user's profile Send private message Visit poster's website
mqjeff
PostPosted: Thu Mar 20, 2014 4:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why do you need the namespace?

What part of the message will it be attached to?

How are you otherwise building the message that is being provided to the SOAPRequest node?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Mar 20, 2014 5:31 am    Post subject: Reply with quote

Grand High Poobah

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

Can you specify if the need for a namespace is attached to the passing of the operation in the LocalEnvironment?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
fatherjack
PostPosted: Thu Mar 20, 2014 7:22 am    Post subject: Reply with quote

Knight

Joined: 14 Apr 2010
Posts: 522
Location: Craggy Island

sebastia wrote:
How can I get the namespace from a table


The same way you are getting your URL and Operation from a table.

sebastia wrote:
AND SET IT ?


DECLARE ns NAMESPACE etc. and then put it in the message you are building.
_________________
Never let the facts get in the way of a good theory.
Back to top
View user's profile Send private message
sebastia
PostPosted: Fri Mar 21, 2014 12:40 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

The actual code, that runs perfectly, is this one:
Code:
      declare ws_num char ;
      set ws_num = trim ( InputRoot.XMLNSC.Mensaje.wsn ) ;
      
      CASE ws_num

         WHEN '1' THEN -- <Mensaje> <Evento> EVENT/WS </Evento> <wsn> 1 </wsn> </Mensaje>

            declare q0 NAMESPACE 'http://wsServer.myfirst.com/' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = 'http://localhost:8080/wsServer_hello' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = 'getGreeting' ;
            set OutputRoot.SOAP.Body.q0:getGreeting.arg0 = 'sebasV2.a' ;
         
         WHEN '2' THEN -- <Mensaje> <Evento> EVENT/WS </Evento> <wsn> 2 </wsn> </Mensaje>

            declare q1 NAMESPACE 'http://tod.ws.com/' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = 'http://localhost:1212/TOD_server' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = 'say_TOD' ;
            set OutputRoot.SOAP.Body.q1:say_TOD.arg0 = 'sebasV2.b' ;
               
         else
            SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = 'http://localhost:8080/not.found.com' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = 'unknown' ;
         
      END CASE ;


As you can see, the text of the message is not important (by now).

We need to generalize this "CASE" approach in order to be able to get the URL and Operation values from a table, indexed by "ws_num".
And the "declare" statement is the problem.

Jeff - I cant answer "why I need the namespace".
What I see is that it is used in the setting of the Output :

Code:
set OutputRoot.SOAP.Body.q0:getGreeting.arg0 = 'sebasV2.a'
set OutputRoot.SOAP.Body.q1:say_TOD.arg0 = 'sebasV2.b' ;


... because I know the XML that has to be generated has the form

Code:
<q0:getGreeting><arg0>sebasas</arg0></q0:getGreeting>


or

Code:
<q0:say_TOD><arg0>pepeta</arg0></q0:say_TOD>


for the second case.

So, I think I can answer to
Quote:
the need for a namespace is attached to the passing of the operation in the LocalEnvironment?

... with a "yes", right ?

Thanks.

mr FatherJack : we need our code to have this structure :

Code:
set ws_num = trim ( InputRoot.XMLNSC.Mensaje.wsn ) ; -- get index
SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = Table_URLs [ ws_num ] ;
SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = Table_Operations [ ws_num ] ;


... and now comes the namespace I dont know how to manage ...
Back to top
View user's profile Send private message Visit poster's website
Armageddon123
PostPosted: Fri Mar 21, 2014 4:27 am    Post subject: Reply with quote

Acolyte

Joined: 11 Feb 2014
Posts: 61

From what i understand, the question is how to define a namespace in the xml when u dont know what is the namespace beforehand.

use variables for namespace!!
get the namespace from table, assign to variable and use it in the
set OutputRoot.SOAP.Body... statement.

from
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fak04980_.htm

Quote:
SET OutputRoot.XMLNS.{prefixOne}:{'PurchaseOrder'} =
InputRoot.XMLNS.prefixOne:PurchaseOrder;


might be i got the whole question wrong!!, , did I?
Back to top
View user's profile Send private message
sebastia
PostPosted: Fri Mar 21, 2014 5:07 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Looks pretty good to me ... Shall try Monday first hour.

Today .. it's Friday 3 pm here ...

Have a nice weekend all !
Back to top
View user's profile Send private message Visit poster's website
sebastia
PostPosted: Tue Apr 01, 2014 5:07 am    Post subject: Reply with quote

Grand Master

Joined: 07 Oct 2004
Posts: 1003

Hi, coleagues - here you are the code to call a web service in both modes :

1) specific, using WSDL

2) generic (SOAP Request node in gateway mode)

Requires 3 parameters:
1) namespace
2) URL
3) operation

Code:

      CASE ws_num

         WHEN '1' THEN -- <Mensaje> <Evento> EVENT/WS </Evento> <wsn> 1 </wsn> </Mensaje>

            declare q0 NAMESPACE 'http://wsServer.myfirst.com/' ;
            SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:q0 = 'http://wsServer.myfirst.com/' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = 'http://localhost:8080/wsServer_hello' ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = 'getGreeting' ;
            set OutputRoot.SOAP.Body.q0:getGreeting.arg0 = 'sebas using 1st web service' ;
         
         WHEN '2' THEN -- <Mensaje> <Evento> EVENT/WS </Evento> <wsn> 2 </wsn> </Mensaje>

            declare q1 CHARACTER ;
            set q1 = 'http://tod.ws.com/' ; -- (1) input
            declare operacion CHARACTER ;
            set operacion = 'say_TOD' ; -- (2) input

            SET OutputRoot.SOAP.Context.Namespace.(SOAP.NamespaceDecl)xmlns:q1 = q1 ;
            SET OutputLocalEnvironment.Destination.SOAP.Request.Transport.HTTP.WebServiceURL = 'http://localhost:8181/TOD_server' ; -- (3) input
            SET OutputLocalEnvironment.Destination.SOAP.Request.Operation = operacion ;

            CREATE LASTCHILD OF OutputRoot.SOAP.Body NAMESPACE q1 NAME operacion ;  -- this line does the trick
            set OutputRoot.SOAP.Body.*.arg0 =  'sebas uses 2nd web service' ;       -- web service input parameter
               
         else


Enjoy. Sebastian.
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 » SOAP Req, Generic WebService - namespace ?
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.