BizTalk Gurus

soap attachment

rated by 0 users
Not Answered This post has 0 verified answers | 12 Replies | 2 Followers

posted on Thu, Jan 14 2010 7:22 AM

                                                                   Hi everybody,

 

 

In my biztalk application i have to send a file thru a send soap port (or more surely a wcf-custom port) .

The schema of this xml file has been generated from a wsdl.

One of the element of the schema has reference (href) to another xml file generated before in the orchestration.

The xml file and the refered xml file must be sent together in the same soap envelope (multiref).

How to do that ?

 

If it's a wcf-custom port that is to be used, what is the configuration of it in the biztalk admin console ?

 

Regards

All Replies

Top 10 Contributor
234 Posts
xman71 replied on Thu, Jan 14 2010 9:59 AM

Hi,

 

   Check the following MS publication to see if that answers your question(s):

 

http://technet.microsoft.com/en-us/library/bb226478(BTS.20).aspx?wt.svl=prodtechnol

 

   Daniel.

 

"Google skills are more important than your coding skills."

replied on Fri, Jan 15 2010 2:16 AM

thanx a lot, i'm gonna try this, but perhaps not with a netnamedpipe, i'll tell you how it works.

replied on Thu, Jan 21 2010 4:44 AM

                                                                                           Hi Xman71,

 

     I come back to you for this soap attachment:

 

In visual studio 2005 from a wsdl file (sent by the custommer) i have generated port type and message type and everything that go with these.

 

the generated message type is this one :

  <?xml version="1.0" encoding="utf-16" ?>
- <xs:schema xmlns:tns="http://messages.commun.titi.toto.com" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="http://messages.commun.titi.toto.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Message" nillable="true" type="tns:Message" />
- <xs:complexType name="Message">
- <xs:sequence>
  <xs:element minOccurs="1" maxOccurs="1" name="auditCre" nillable="true" type="xs:dateTime" />
  <xs:element minOccurs="1" maxOccurs="1" name="auditUpd" nillable="true" type="xs:dateTime" />
  <xs:element minOccurs="1" maxOccurs="1" name="avisCree" type="xs:boolean" />
  <xs:element minOccurs="1" maxOccurs="1" name="codeFournisseur" type="xs:int" />
  <xs:element minOccurs="1" maxOccurs="1" name="dateCree" nillable="true" type="xs:dateTime" />
  <xs:element minOccurs="1" maxOccurs="1" name="datemsg" nillable="true" type="xs:dateTime" />
  <xs:element minOccurs="0" maxOccurs="1" name="envCible" type="xs:string" />
  <xs:element minOccurs="0" maxOccurs="1" name="etatMsg" type="xs:string" />
  <xs:element minOccurs="1" maxOccurs="1" name="factureCree" type="xs:boolean" />
  <xs:element minOccurs="0" maxOccurs="1" name="fullEditCorrecteur" type="xs:string" />
  <xs:element minOccurs="1" maxOccurs="1" name="idMessage" type="xs:int" />
  <xs:element minOccurs="1" maxOccurs="1" name="idPieceJointe" type="xs:int" />
  <xs:element minOccurs="0" maxOccurs="1" name="interchange" type="xs:string" />
  <xs:element minOccurs="0" maxOccurs="1" name="message" type="xs:base64Binary" />
  <xs:element minOccurs="0" maxOccurs="1" name="nomExp" type="xs:string" />
  <xs:element minOccurs="0" maxOccurs="1" name="refAsso" type="xs:string" />
  <xs:element minOccurs="0" maxOccurs="1" name="refMessage" type="xs:string" />
  <xs:element minOccurs="0" maxOccurs="1" name="repMess" type="xs:string" />
  <xs:element minOccurs="0" maxOccurs="1" name="typeMessage" type="xs:string" />
  </xs:sequence>
  </xs:complexType>
  </xs:schema>

 

this message will be sent thru the generated send port.

 

if, in the biztalk admin console, i configure the generated send port as a soap port, it works fine.

 

Now the element idMessage in the structure of the generated message make a reference to another xml file generated before in the same biztalk orchestration and i have to send these 2 messages together in the same soap envelope, the 2nd one as a soap attachment.

 

How to do that ?

 

I've tried to do this (it didn't work) :

 

In the biztalk admin console

       - i have configured the generated send port as a WCF-WSHttp port (Static Solicit-Response),

       - in the Address (URI) i have put the url of the web service,

       - in the Messages tab,

                  * in the inbound biztalk message body i have choosen Path

                  * and put the infopath of the main element of the attached xml file in the body path expression

 

for the moment no proxy, no certificate.

 

Something's wrong ? something's lacking ?

 

Thank you for your help.

 

Best regards.

Top 10 Contributor
877 Posts

What is the mechanism for attaching the additional file. The choices are MIME, DIME or MTOM
DIME is a Microsoft specification that never really took off, so it will probably be MIME or MTOM.

 

replied on Thu, Jan 21 2010 6:00 AM

mime is not proposed in the biztalk admin console, only Mtom and Text proposed in the encoding binding

Top 10 Contributor
877 Posts

You will need to add your second Xml file as a Base64 string to the Message field of your message. This will require a C# helper class and making the message element a distinguished field

Message.message = ConvertXmlToBase64(XMlDocument secondXml);

Then use MTOM encoding on the Binding tab of the WCF Transport Properties.

You will need to confirm with the web service publisher that MTOM is the correct attchment mechanism.

 

replied on Thu, Jan 21 2010 8:00 AM

thanx a lot Greg !

As you can see in the xml document structure above there are 2 elements that could be used to do what you're saying :

         - idMessage (xs:int)

         - message (xs:base64Binary)

 

it's said by the custommer (who gave the wsdl) that message doesn't work (i don't know why, but it may work ?, and the web service is in java).

Actually i'd be tempted to put the attached xml file in message, but message cannot be distinguished in biztalk because of its type (base64Binary cannot be distinguished).

 

I think we're about to resolve this problem, just a little precision...

 

Thanx again

 

replied on Fri, Jan 22 2010 9:08 AM

Any other help ?

 

Regards

replied on Fri, Jan 22 2010 11:13 AM

it doesn't seem to work :

making the message element a distinguished field

the base64 element cannot be distinguished

Message.message = ConvertXmlToBase64(XMlDocument secondXml);

How and where to do that, in an orchestration (assignment), mapping, ...

 

Regards

Top 10 Contributor
877 Posts

You can use the xpath function to assign a value to a node:

xpath(Message, "/*[local-name()='Message']/*[local-name()='message']") = ConvertXmltoBase64(XmlDocument secondXml);

 

replied on Fri, Jan 22 2010 1:49 PM

i'll try this next week, i'll tell you how it works.

I'll put this code in a message assignment before sending it to the soap port.

A little problem is how to access secondXml ? by xpath ? and to pass this parameter in the convert method ? I'll try this, but the call of this method doesn't work, impossible to cast this xpathdocument to an xmldocument.

 

Thank you again, you're of great help.

replied on Tue, Jan 26 2010 9:21 AM

ok, it works ! base64 looks like a viewstate !

thanx

Page 1 of 1 (13 items) | RSS