Author |
Message
|
kwelch |
Posted: Mon Feb 28, 2005 12:26 pm Post subject: namespace help |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Hi again!
I am having problems creating a message with namespaces in the output. I can get them to work except for on the outermost tag. When I try to create a namespace on the outermost tag it fails telling me there is no body to my XML message. Here is a sample of what I need to create:
- <soap:Envelope xmlns:soap="http://www.w3.org/2001/06/soap-envelope">
- <soap:Header>
- <htfd:Command xmlns:htfd="http://www.thehartford.com/SOAP/xml">
<htfd:ServiceName>Client</htfd:ServiceName>
<htfd:CommandName>CreateOrUpdate</htfd:CommandName>
</htfd:Command>
</soap:Header>
- <soap:Body>
- <acord:ACORD xmlns:acord="http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/" xmlns:htfd="http://www.thehartford.com/ACORD/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <acord:SignonRq xmlns:acord="http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <acord:SignonPswd>
- <acord:CustId>
<acord:SPName />
<acord:CustPermId />
<acord:CustLoginId>xxxxxxxxx</acord:CustLoginId>
</acord:CustId>
- <acord:CustPswd>
<acord:EncryptionTypeCd />
<acord:Pswd />
</acord:CustPswd>
</acord:SignonPswd>
<acord:ClientDt />
<acord:CustLangPref />
- <acord:ClientApp>
<acord:Org />
<acord:Name />
<acord:Version />
</acord:ClientApp>
</acord:SignonRq>
- <acord:InsuranceSvcRq>
<acord:RqUID />
- <acord:PersPkgPolicyQuoteInqRq>
<acord:RqUID />
<acord:TransactionRequestDt />
<acord:TransactionEffectiveDt />
<acord:CurCd>USD</acord:CurCd>
- <acord:Producer>
- <acord:ProducerInfo>
<acord:ContractNumber>11111111111</acord:ContractNumber>
<htfd:com.thehartford_RegionalOfficeCd>00</htfd:com.thehartford_RegionalOfficeCd>
</acord:ProducerInfo>
</acord:Producer>
- <acord:InsuredOrPrincipal>
- <acord:GeneralPartyInfo>
- <acord:NameInfo>
- <acord:PersonName>
<acord:Surname>Smith</acord:Surname>
<acord:GivenName>Al</acord:GivenName>
</acord:PersonName>
</acord:NameInfo>
- <acord:Addr>
<acord:Addr1>23 MAIN ST</acord:Addr1>
<acord:City>ANSONIA</acord:City>
<acord:StateProvCd>CT</acord:StateProvCd>
<acord:PostalCode>06401</acord:PostalCode>
</acord:Addr>
- <acord:Communications>
- <acord:EmailInfo>
<acord:EmailAddr>test@test.com</acord:EmailAddr>
</acord:EmailInfo>
</acord:Communications>
</acord:GeneralPartyInfo>
- <acord:InsuredOrPrincipalInfo>
<acord:InsuredOrPrincipalRoleCd>Insured</acord:InsuredOrPrincipalRoleCd>
<htfd:com.thehartford_AccountNumberId />
<htfd:com.thehartford_MembershipNumber>222222222</htfd:com.thehartford_MembershipNumber>
<htfd:com.thehartford_MembershipTypeCd>test</htfd:com.thehartford_MembershipTypeCd>
</acord:InsuredOrPrincipalInfo>
</acord:InsuredOrPrincipal>
- <acord:PersPolicy>
<acord:LOBCd>contact admin</acord:LOBCd>
<acord:ControllingStateProvCd>CT</acord:ControllingStateProvCd>
<acord:OriginalInceptionDt>2005-02-18</acord:OriginalInceptionDt>
- <acord:QuoteInfo>
<acord:CompanysQuoteNumber />
- <acord:ItemIdInfo>
<acord:InsurerId />
</acord:ItemIdInfo>
</acord:QuoteInfo>
<htfd:com.thehartford_RegionalOfficeCd>55</htfd:com.thehartford_RegionalOfficeCd>
<htfd:com.thehartford_InsurerId>2223131231313131313131</htfd:com.thehartford_InsurerId>
<htfd:com.thehartford_ObjectTransactionTypeCd>04</htfd:com.thehartford_ObjectTransactionTypeCd>
<htfd:com.thehartford_MarketingCd />
<htfd:com.thehartford_BusinessUnitId>46</htfd:com.thehartford_BusinessUnitId>
<htfd:com.thehartford_ObjectStatusCd>SA</htfd:com.thehartford_ObjectStatusCd>
<htfd:com.thehartford_ContractTypeCd />
<htfd:com.thehartford_DistributionBusinessPartner>002</htfd:com.thehartford_DistributionBusinessPartner>
<htfd:com.thehartford_ApplicationReceivedCd>N</htfd:com.thehartford_ApplicationReceivedCd>
<htfd:com.thehartford_PerceivedBindCd>N</htfd:com.thehartford_PerceivedBindCd>
<htfd:com.thehartford_ObjectCompletionDt>2005-02-18</htfd:com.thehartford_ObjectCompletionDt>
</acord:PersPolicy>
- <acord:PersPkgUmbrellaLineBusiness>
<acord:LOBCd>UMBRP</acord:LOBCd>
</acord:PersPkgUmbrellaLineBusiness>
</acord:PersPkgPolicyQuoteInqRq>
</acord:InsuranceSvcRq>
</acord:ACORD>
</soap:Body>
</soap:Envelope>
Here is a code snippet:
SET OutputRoot.Properties.MessageFormat = 'XMLNS';
SET OutputLocalEnvironment = InputLocalEnvironment;
SET OutputRoot.MQMD.[] = InputLocalEnvironment.MQMD.[];
DECLARE acord1 NAMESPACE 'http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/';
DECLARE htfd1 NAMESPACE 'http://www.thehartford.com/ACORD/xml';
DECLARE soap1 NAMESPACE 'http://www.w3.org/2001/06/soap-envelope';
SET OutputRoot.XMLNS.Envelope.(XML.NamespaceDecl)xmlns:acord = 'http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/';
SET OutputRoot.XMLNS.Envelope.(XML.NamespaceDecl)xmlns:htfd = 'http://www.thehartford.com/ACORD/xml';
SET OutputRoot.XMLNS.Envelope.(XML.NamespaceDecl)xmlns:soap = 'http://www.w3.org/2001/06/soap-envelope';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Header.[] = InputLocalEnvironment.soaphdr.[];
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:RqUID = '';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:PersPkgPolicyQuoteInqRs.acord1:RqUID = '';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:PersPkgPolicyQuoteInqRs.acord1:TransactionResponseDt = '';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:PersPkgPolicyQuoteInqRs.acord1:CurCd = '';
This does not work. If I remove the soap1: in front of Envelope it will work but then I just get <Envelope> as the outer tag instead of <soap:Envelope>
Any ideas as to what I am doing incorrectly? Thanks!
Karen |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 28, 2005 12:35 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Always try the stupid stuff first - put quotes around "soap1:Envelope". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kwelch |
Posted: Mon Feb 28, 2005 1:17 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Thanks for the suggestion but that did not work. |
|
Back to top |
|
 |
Craig B |
Posted: Tue Mar 01, 2005 10:46 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
From the ESQL you have written it seems like you have created two root tags in your XMLNS tree which is not allowed. The XMLNS writer will reject this with the 'No valid body of document could be found' error message.
You have lines of ESQL such as :
Code: |
SET OutputRoot.XMLNS.Envelope. ....
|
and you have lines such as :
Code: |
SET OutputRoot.XMLNS.soap1:Envelope. ..
|
So this creates a parent element called Envelope that is not in a namespace, and then creates a parent element called Envelope that is in the soap1 namespace. This gives you two different root tags.
If you want to have Envelope in the soap1 namespace, then all your SET statements for Envelope should satart with SET OutputRoot.XMLNS.soap1:Envelope....
Hope this helps. _________________ Regards
Craig |
|
Back to top |
|
 |
kwelch |
Posted: Tue Mar 01, 2005 10:55 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Hi,
I coded that from an example in the esql manual on how to get the namespace to appear on the output message. However, I have followed your advice and coded everything with soap1:Envelope and I get the same error message. It does not seem to want me to have the outer tag as a namespace. When I remove the namespace from the outer tag all works well except I don't get the output message my customer expects.
Thanks,
Karen |
|
Back to top |
|
 |
Craig B |
Posted: Tue Mar 01, 2005 11:13 am Post subject: |
|
|
Partisan
Joined: 18 Jun 2003 Posts: 316 Location: UK
|
Hi,
Since I dont have your input message, I wrote the following ESQL in my FP04 environment :
Code: |
DECLARE acord1 NAMESPACE 'http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/';
DECLARE htfd1 NAMESPACE 'http://www.thehartford.com/ACORD/xml';
DECLARE soap1 NAMESPACE 'http://www.w3.org/2001/06/soap-envelope';
SET OutputRoot.XMLNS.soap1:Envelope.(XML.NamespaceDecl)xmlns:acord = 'http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/';
SET OutputRoot.XMLNS.soap1:Envelope.(XML.NamespaceDecl)xmlns:htfd = 'http://www.thehartford.com/ACORD/xml';
SET OutputRoot.XMLNS.soap1:Envelope.(XML.NamespaceDecl)xmlns:soap = 'http://www.w3.org/2001/06/soap-envelope';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Header.[] = InputLocalEnvironment.soaphdr.[];
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:RqUID = '';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:PersPkgPolicyQuoteInqRs.acord1:RqUID = '';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:PersPkgPolicyQuoteInqRs.acord1:TransactionResponseDt = '';
SET OutputRoot.XMLNS.soap1:Envelope.soap1:Body.acord1:ACORD.acord1:InsuranceSvcRs.acord1:PersPkgPolicyQuoteInqRs.acord1:CurCd = '';
|
And this produced the following Output message :
Code: |
<soap:Envelope xmlns:acord="http://www.ACORD.org/standards/PC_Surety/ACORD1.6.0/xml/" xmlns:htfd="http://www.thehartford.com/ACORD/xml" xmlns:soap="http://www.w3.org/2001/06/soap-envelope">
<soap:Header/>
<soap:Body>
<acord:ACORD>
<acord:InsuranceSvcRs>
<acord:RqUID></acord:RqUID>
<acord:PersPkgPolicyQuoteInqRs>
<acord:RqUID></acord:RqUID>
<acord:TransactionResponseDt></acord:TransactionResponseDt>
<acord:CurCd></acord:CurCd>
</acord:PersPkgPolicyQuoteInqRs>
</acord:InsuranceSvcRs>
</acord:ACORD>
</soap:Body>
</soap:Envelope>
|
This shows that the proposed code will accept a Namespace on the root tag. I would suggest putting a trace node before you MQOutput node and trace ${Root}. This should show you what your output message tree looks like. If you cant spot what is wrong with it, I can take a look at it. _________________ Regards
Craig |
|
Back to top |
|
 |
kwelch |
Posted: Tue Mar 01, 2005 1:56 pm Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 255
|
Thanks for your help! Other than a few minor issues with the Soap Header I am now able to get the message wrapped in a soap Envelope.
Karen |
|
Back to top |
|
 |
|