Author |
Message
|
matam_viswa |
Posted: Tue Jul 10, 2007 6:36 am Post subject: XMLNS problem while generating the message for WS |
|
|
Novice
Joined: 30 Jul 2006 Posts: 17
|
Hi All,
I need help from the group.
My webservice is working fine and i am facing problem with supplying the correct input to the webservice.
webservice expects the input as below
-----------
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<RequestTaxYears xmlns="http://www.liberty.co.za/">
<node>
<TXLifeRequest>
<TransRefGUID>414d51204c4d4436554d5149202020204624a52022187902</TransRefGUID>
<TransType tc="310">Contribution Certificate</TransType>
<TransExeDate>2007-04-01</TransExeDate>
<OLifE>
<Holding id="HOLD">
<HoldingKey>10001733</HoldingKey>
<OLifEExtension VendorCode="LIB" SystemCode="CATCH">
<DocumentType tc="1">Contribution Certificate</DocumentType>
</OLifEExtension>
</Holding>
</OLifE>
</TXLifeRequest>
</node>
</RequestTaxYears>
</soap:Body>
</soap:Envelope>
-----------------
I am able to generate message as below for webservice
but i need to generate <RequestTaxYears xmlns="http://www.liberty.co.za/"> instead of <RequestTaxYears> below.
-
--------------
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body>
<RequestTaxYears>
<node>
<TXLifeRequest>
<TransRefGUID>414d51204c4d4436554d5149202020204624a52022187902</TransRefGUID>
<TransType tc="310">Contribution Certificate</TransType>
<TransExeDate>2007-04-01</TransExeDate>
<OLifE>
<Holding id="HOLD">
<HoldingKey>10001733</HoldingKey>
<OLifEExtension VendorCode="LIB" SystemCode="CATCH">
<DocumentType tc="1">Contribution Certificate</DocumentType>
</OLifEExtension>
</Holding>
</OLifE>
</TXLifeRequest>
</node>
</RequestTaxYears>
</soap:Body>
</soap:Envelope>
----------
The code iam using here to generate the above message is
Code:
CREATE COMPUTE MODULE FLOWFORWSO_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
SET OutputRoot.Properties.MessageSet='JM30L2O002001';
SET OutputRoot.Properties.MessageFormat='XML';
SEt OutputRoot.Properties.MessageType='Envelope';
SET OutputRoot.MQMD.Format ='MQSTR';
SET Environment.Variables.msgblob = InputRoot.BLOB.BLOB;
SET Environment.Variables.msgchar = CAST(Environment.Variables.msgblob as char CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);
SET OutputRoot.MRM.soap:Body.RequestTaxYears.node = Environment.Variables.msgchar;
RETURN TRUE;
END;
I am using the WSDL file in my messageSET for creating message definition file.
Please find my WSDL as below
-----------------------
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://www.liberty.co.za/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://www.liberty.co.za/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.liberty.co.za/">
<s:element name="RequestOnline">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="node">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestOnlineResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="RequestOnlineResult" type="s:boolean" />
<s:element minOccurs="0" maxOccurs="1" name="node">
<s:complexType mixed="true">
<s:sequence>
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetRole">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="userName" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetRoleResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetRoleResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestTaxYears">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="node" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestTaxYearsResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestTaxYearsResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ProcessJob">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="JobType" type="s:int" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="ProcessJobResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="ProcessJobResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SetMQSIStatus">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestXML" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SetMQSIStatusResponse">
<s:complexType />
</s:element>
<s:element name="RequestDuplicateCertificate">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="InputXML" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="RequestDuplicateCertificateResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="RequestDuplicateCertificateResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="RequestOnlineSoapIn">
<wsdl:part name="parameters" element="tns:RequestOnline" />
</wsdl:message>
<wsdl:message name="RequestOnlineSoapOut">
<wsdl:part name="parameters" element="tns:RequestOnlineResponse" />
</wsdl:message>
<wsdl:message name="GetRoleSoapIn">
<wsdl:part name="parameters" element="tns:GetRole" />
</wsdl:message>
<wsdl:message name="GetRoleSoapOut">
<wsdl:part name="parameters" element="tns:GetRoleResponse" />
</wsdl:message>
<wsdl:message name="RequestTaxYearsSoapIn">
<wsdl:part name="parameters" element="tns:RequestTaxYears" />
</wsdl:message>
<wsdl:message name="RequestTaxYearsSoapOut">
<wsdl:part name="parameters" element="tns:RequestTaxYearsResponse" />
</wsdl:message>
<wsdl:message name="ProcessJobSoapIn">
<wsdl:part name="parameters" element="tns:ProcessJob" />
</wsdl:message>
<wsdl:message name="ProcessJobSoapOut">
<wsdl:part name="parameters" element="tns:ProcessJobResponse" />
</wsdl:message>
<wsdl:message name="SetMQSIStatusSoapIn">
<wsdl:part name="parameters" element="tns:SetMQSIStatus" />
</wsdl:message>
<wsdl:message name="SetMQSIStatusSoapOut">
<wsdl:part name="parameters" element="tns:SetMQSIStatusResponse" />
</wsdl:message>
<wsdl:message name="RequestDuplicateCertificateSoapIn">
<wsdl:part name="parameters" element="tns:RequestDuplicateCertificate" />
</wsdl:message>
<wsdl:message name="RequestDuplicateCertificateSoapOut">
<wsdl:part name="parameters" element="tns:RequestDuplicateCertificateResponse" />
</wsdl:message>
<wsdl:portType name="WCatchSoap">
<wsdl:operation name="RequestOnline">
<wsdl:input message="tns:RequestOnlineSoapIn" />
<wsdl:output message="tns:RequestOnlineSoapOut" />
</wsdl:operation>
<wsdl:operation name="GetRole">
<wsdl:input message="tns:GetRoleSoapIn" />
<wsdl:output message="tns:GetRoleSoapOut" />
</wsdl:operation>
<wsdl:operation name="RequestTaxYears">
<wsdl:input message="tns:RequestTaxYearsSoapIn" />
<wsdl:output message="tns:RequestTaxYearsSoapOut" />
</wsdl:operation>
<wsdl:operation name="ProcessJob">
<wsdl:input message="tns:ProcessJobSoapIn" />
<wsdl:output message="tns:ProcessJobSoapOut" />
</wsdl:operation>
<wsdl:operation name="SetMQSIStatus">
<wsdl:input message="tns:SetMQSIStatusSoapIn" />
<wsdl:output message="tns:SetMQSIStatusSoapOut" />
</wsdl:operation>
<wsdl:operation name="RequestDuplicateCertificate">
<wsdl:input message="tns:RequestDuplicateCertificateSoapIn" />
<wsdl:output message="tns:RequestDuplicateCertificateSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WCatchSoap" type="tns:WCatchSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="RequestOnline">
<soap:operation soapAction="http://www.liberty.co.za/RequestOnline" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetRole">
<soap:operation soapAction="http://www.liberty.co.za/GetRole" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RequestTaxYears" xmlns="http://www.liberty.co.za/" >
<soap:operation soapAction="http://www.liberty.co.za/RequestTaxYears" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="ProcessJob">
<soap:operation soapAction="http://www.liberty.co.za/ProcessJob" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="SetMQSIStatus">
<soap:operation soapAction="http://www.liberty.co.za/SetMQSIStatus" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="RequestDuplicateCertificate">
<soap:operation soapAction="http://www.liberty.co.za/RequestDuplicateCertificate" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WCatch">
<wsdl:port name="WCatchSoap" binding="tns:WCatchSoap">
<soap:address location="http://Lolita/CatchService/service.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
-------------- |
|
Back to top |
|
 |
wbi_telecom |
Posted: Tue Jul 10, 2007 7:24 am Post subject: |
|
|
 Disciple
Joined: 15 Feb 2006 Posts: 188 Location: Harrisburg, PA
|
You have not assigned any Namespace to RequestTaxYears in your esql.
Cheers, |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 10, 2007 3:53 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
wbi_telecom wrote: |
You have not assigned any Namespace to RequestTaxYears in your esql.
Cheers, |
Except, of course, that matam_viswa is using MRM.
So it is not in the ESQL that the namespace needs to be assigned. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
matam_viswa |
Posted: Tue Jul 10, 2007 11:24 pm Post subject: XMLNS problem while generating the message for WS |
|
|
Novice
Joined: 30 Jul 2006 Posts: 17
|
I declared the name space but i missed y'day while coping to post
Code: |
DECLARE ns NAMESPACE 'http://www.liberty.co.za/';
DECLARE soap NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';CREATE COMPUTE MODULE FLOWFORWSO_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
SET OutputRoot.Properties.MessageSet='JM30L2O002001';
SET OutputRoot.Properties.MessageFormat='XML';
SEt OutputRoot.Properties.MessageType='Envelope';
SET OutputRoot.MQMD.Format ='MQSTR';
SET Environment.Variables.msgblob = InputRoot.BLOB.BLOB;
SET Environment.Variables.msgchar = CAST(Environment.Variables.msgblob as char CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);
SET OutputRoot.MRM.soap:Body.RequestTaxYears.node = Environment.Variables.msgchar;
RETURN TRUE;
END;
|
I tried to use like
SET OutputRoot.MRM.soap:Body.RequestTaxYears.(XML.attr)xmlns ='http://www.liberty.co.za/';
but in output message xmlns is considing as element of RequestTaxYears but not as attribute.
Can you please let me know how to add namespace to the element RequestTaxYears. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 11, 2007 12:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Code: |
<RequestTaxYears xmlns="http://www.liberty.co.za/"> |
So RequestTaxYears is in (default) namespace "http://www.liberty.co.za/"
When the message is written out, the syntax element for RequestTaxYears must have that namespace ( and that applies whether or not the MRM domain is being used ).
So...
- I agree with wbi_telecom : RequestTaxYears needs a namespace
- matam_viswa has not yet assigned a namespace to RequestTaxYears. He has declared a special kind of ESQL constant with the name 'soap' and the value "http://www.liberty.co.za/". The code he needs is ( not tested ):
Code: |
SET OutputRoot.MRM.soap:Body.RequestTaxYears.node = Environment.Variables.msgchar; |
re: MRM and namespace prefixes:
- If using MRM, the XML namespace prefixes can be set via the XML message set properties.
- If using XMLNS or XMLNSC, namespace prefixes are controlled by the namespace declarations in the message tree.
- If neither option is taken, WMB will assign sequentially numbered prefixes like 'NS1', 'NS2'.
In this case, we need a 'default namespace'. Unfortunately you cannot specify an empty prefix in the XML message set properties. You will have to generate an output document which contains a non-empty prefix. This will not change the meaning of the document at all - the downstream application should not care. |
|
Back to top |
|
 |
matam_viswa |
Posted: Wed Jul 11, 2007 1:15 am Post subject: |
|
|
Novice
Joined: 30 Jul 2006 Posts: 17
|
Hi Kimbert,
I assignes namespace as flow level. But now i want i assign namespace xmlns="http://www.liberty.co.za/" to the element RequestTaxYears.
I tried to to modify the message definition file(i.e to add xmlns as attribute of the element RequestTaxYears) but its not accepting because xmlns is a reserve/keyword in ESQL.
Can you please let me know how to assign namespace to the element in ESQL code. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 11, 2007 2:44 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Please read my previous post again. The MRM parser does not use namespace declarations ( xmlns attributes ) to control XML prefixes. It uses a table in the message set. But even if you use that table, you cannot output an empty namespace prefix using the MRM parser because it does not allow you to enter "" as the prefix. |
|
Back to top |
|
 |
wbi_telecom |
Posted: Wed Jul 11, 2007 7:07 am Post subject: |
|
|
 Disciple
Joined: 15 Feb 2006 Posts: 188 Location: Harrisburg, PA
|
From Infocenter
If you have defined an MRM element in a namespace other than the noTarget namespace, you must also specify a namespace prefix in the statement. For example:
DECLARE brw NAMESPACE 'http://www.ibm.com/Borrowed';
SET OutputRoot.MRM.brw:Borrowed.VideoTitle = 'MRM Greatest Hits';
Can you try delaring the namespace and prefixing the tag in your SET statement.
Cheers, |
|
Back to top |
|
 |
|