Author |
Message
|
pottas |
Posted: Thu Aug 27, 2009 1:14 am Post subject: Casting Incoming XML Header to a String format |
|
|
 Disciple
Joined: 27 Oct 2005 Posts: 185 Location: South Africa
|
I have searched MQ Series for the part day and found no real solution for my issue.
I have a web Service exposed that accepts a message that looks like:
Code: |
<s:Envelope xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/schemas/management">
<s:Header>
<sec:SecondaryCredential xmlns:sec="http://contracts.it.nednet.co.za/Infrastructure/2009/08/SecondaryCredential">
<saml2:Assertion ID="uuid-849bef8d-291a-4056-baf8-94e92b616723" Version="2.0" IssueInstant="2009-08-25T13:08:06Z" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"><saml2:Issuer>DataPower STS</saml2:Issuer><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" /><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" /><ds:DigestValue>RS+SobtaHngB5s02TdhmYeCc+go=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>I0hRxU0qz3wLh2JEPE8iAZGbVmaBOo9zg+ObblQxY5IBwQh27FkKwi2NiHiY1BNQhLieo4dY1CtXGyojfDenNx+OapWnBHlGgqwbmWqOiyURh5gXcMpZ5aOzSFtKQhLR1G5BYeTmimzc+sZhoZFr5CbbJjbsNQZgZ+uARc6ja3g=</ds:SignatureValue><ds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vDANBgkqhkiG9w0BAQUFAAOBgQCFPLzoAAtRApgczn6XvOp4YFJi+0I+QtsxRlet2RgOaQLJmNTRb0DSnU+ymo5ryeXlry9cYoKLjcBj8w3iL0gvs/ccPRl33OnHkU/jorA93obCNwcWnHYbdHufn0mqr4MniNcGOgqDZLVW2Tle0YJ8J1bmpj14e0KMVltZuOtzPw==</ds:X509Certificate><ds:X509IssuerSerial><ds:X509IssuerName>CN=SAMLEncryption, OU=AIS, OU=Group Technology, O=Nedbank Ltd, L=Nedbank Park, ST=Gauteng, C=SA</ds:X509IssuerName><ds:X509SerialNumber>110040453</ds:X509SerialNumber></ds:X509IssuerSerial></ds:X509Data></ds:KeyInfo></ds:Signature><saml2:Subject><saml2:NameID format="urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos">NB136934@AFRICA.NEDCOR.NET</saml2:NameID><saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:holder-of-key"><saml2:SubjectConfirmationData xsi:type="saml2:KeyInfoConfirmationDataType" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance"><ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#"><RSAKeyValue><Modulus>u1XTHSuWAjT8ninJ19T+i6kOT60fY8Ofd3qDgn3VlTsKxFsy2UHpGV9iWL6Lz09Oc34j2kVKzituHlrvhuPUuvZBffOnnIX/8J4R1YpC9O8EmFVK49U/C1vKpf78SDCBN6vYaoCtEgO/ebs+1ecvqXDwYYqlpH0HNrkNvGmzMos=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></ds:KeyInfo></saml2:SubjectConfirmationData></saml2:SubjectConfirmation></saml2:Subject><saml2:AttributeStatement><saml2:Attribute Name="AssertedClaim" NameFormat="http://docs.oasis-open.org/ws-sx/ws-trust/200512" FriendlyName="Claims"><saml2:AttributeValue><wst:Claims Dialect="http://schemas.xmlsoap.org/ws/2006/12/authorization/authclaims" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512"><ClaimType Uri="http://claims.nedbank.co.za/functionalAccess" xmlns="http://schemas.xmlsoap.org/ws/2006/12/authorization"><Value>createDuplicateCustomer</Value></ClaimType></wst:Claims></saml2:AttributeValue></saml2:Attribute><saml2:Attribute Name="AppliesTo" NameFormat="http://www.w3.org/2005/08/addressing" FriendlyName="Action"><saml2:AttributeValue><Action xmlns="http://www.w3.org/2005/08/addressing">http://contracts.it.nednet.co.za/services/customer-services/2009-01-10/CustomerValidation/CustAdd</Action></saml2:AttributeValue></saml2:Attribute></saml2:AttributeStatement></saml2:Assertion>
</sec:SecondaryCredential>
<ent:EnterpriseContext xmlns:ent="http://contracts.it.nednet.co.za/Infrastructure/2006-11-01/EnterpriseContext">
<ent:ExecutionContextID/>
<ent:SourceInfo>
<ent:ChannelID/>
</ent:SourceInfo>
<ent:SecurityInfo>
<ent:Ticket>
<ent:Identity>1250625557</ent:Identity>
<ent:AuthenticationLOC>0</ent:AuthenticationLOC>
<ent:SessionSequenceNr>19</ent:SessionSequenceNr>
<ent:ExpiryDateTime>2009-05-02T20:33:51.373</ent:ExpiryDateTime>
<ent:IdentifierType>PSI</ent:IdentifierType>
<ent:TicketSignature>64DBCAA38C0A9BE906EEAD12646B83DC4E302714</ent:TicketSignature>
</ent:Ticket>
</ent:SecurityInfo>
<ent:InstrumentationInfo>
<ent:InstrumentationContextID/>
</ent:InstrumentationInfo>
</ent:EnterpriseContext>
</s:Header>
<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CustAddRq xmlns="http://contracts.it.nednet.co.za/services/customer-services/2009-01-10/CustomerValidation">
<AcctCompanyNo>1</AcctCompanyNo>
<TitleCd>MR</TitleCd>
<CustomerName>
<FirstName>David</FirstName>
<Surname>SMITH</Surname>
</CustomerName>
|
In the Header of the above message, i have a 'saml2:Assertion' string.
After I have done some validations on the incoming message, I need to pick this string from the Header (which at this point is in my LocalEnvironment after the Envelope extract), and do a SOAP Request call to another service with this *exact* string in an XML tag as input.
But, here is where it goes pear-shaped...
Note that the Incoming 'saml2:Assertion' string above has Attribute values defined in it. If I get it from my LocalEnvironment, all the Attribute values are converted to Tags...
I need the exact string as it came from the SOAP Input Header to use for my SOAP Request call.
Anyone? Please? |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Aug 27, 2009 1:35 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
This should be posted in the 'Broker Forum' _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
exerk |
Posted: Thu Aug 27, 2009 2:40 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
Moved... _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
Luke |
Posted: Thu Aug 27, 2009 3:14 am Post subject: |
|
|
Centurion
Joined: 10 Nov 2008 Posts: 128 Location: UK
|
Hi,
I'm not familiar with this specific problem, but in general terms ...
Attributes are usually converted to elements when xml is copied to the LocalEnvironment, because the LocalEnvironment is a simple tree structure. Usually, the solution is to CREATE the field where you want to copy xml to and specify the DOMAIN (e.g. XMLNSC). Attributes will then be retained.
Hope that helps .. ? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Aug 27, 2009 3:23 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
If I get it from my LocalEnvironment, all the Attribute values are converted to Tags |
This is a very common mistake. When you created your Environment tree, you forgot to assign it to the XMLNSC parser.
You need something like:
Code: |
CREATE LASTCHILD OF ENVIRONMENT.Variables DOMAIN XMLNSC TYPE Name Name 'CopyOfXMLNSCSubtree'; |
Not tested, so the syntax is probably incorrect. It's the DOMAIN clause that does the job. |
|
Back to top |
|
 |
pottas |
Posted: Thu Aug 27, 2009 3:24 am Post subject: |
|
|
 Disciple
Joined: 27 Oct 2005 Posts: 185 Location: South Africa
|
Thanks for that reply. I sort of figured this, you confirmed it.
Tell me, can I as an alternative copy the XML Attribute message to the RFH2 Header then. Would that retain the Attribute structure? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Aug 27, 2009 3:29 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
What you would gain by using RFH2 instead of environment? |
|
Back to top |
|
 |
pottas |
Posted: Thu Aug 27, 2009 3:50 am Post subject: |
|
|
 Disciple
Joined: 27 Oct 2005 Posts: 185 Location: South Africa
|
Well, Kimbert, our design looks something like:
SOAPInput --> Extract --> Build RFH2 --> Build COBOL Msg --> SendToHost
...and the route back:
MQInput (from Host) --> Get RFH2 from Q by CorrelId --> Build SOAP Response --> SOAPReply
...all of this because Host cannot handle RFH Headers.
So, all my details ends up in the RFH2 header anyway. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Thu Aug 27, 2009 8:13 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
pottas wrote: |
So, all my details ends up in the RFH2 header anyway. |
Why dont you use the message body for storing this state?
Remember, the usr section of the RFH2 Header is not XML. It does not allow you to store nested tags in it. |
|
Back to top |
|
 |
|