Click here to Skip to main content
15,895,423 members
Home / Discussions / C#
   

C#

 
GeneralRe: default constructor? Pin
S. Senthil Kumar15-Jun-08 23:08
S. Senthil Kumar15-Jun-08 23:08 
GeneralRe: default constructor? Pin
George_George15-Jun-08 21:27
George_George15-Jun-08 21:27 
GeneralRe: default constructor? Pin
Christian Flutcher15-Jun-08 20:53
Christian Flutcher15-Jun-08 20:53 
GeneralRe: default constructor? Pin
George_George15-Jun-08 21:03
George_George15-Jun-08 21:03 
GeneralRe: default constructor? Pin
Christian Flutcher15-Jun-08 21:13
Christian Flutcher15-Jun-08 21:13 
GeneralRe: default constructor? Pin
George_George15-Jun-08 21:28
George_George15-Jun-08 21:28 
QuestionDeserializing a xml document for sending it using a WebService Pin
beatles169215-Jun-08 19:17
beatles169215-Jun-08 19:17 
AnswerRe: Deserializing a xml document for sending it using a WebService Pin
Erik Westermann16-Jun-08 10:57
professionalErik Westermann16-Jun-08 10:57 
I want to make sure I understand...

You have some XML from an InfoPath form and want to pass that to a Web Service. The Web Service takes a parameter (likely a class) that looks something like your XML, but when you try to cast your XML into the Web Service's type by attempting to deserialize your XML you get the error.

If this is the case, you are getting the error because the InfoPath type is different from the type that the Web Service is expecting.

The easiest way to get this to work is to compare what the web service expects with the XML from infopath. If only the namespace, or namespace prefix, or both is/are different, you could take the quick route and use basic string manipulation to remove/edit as necessary.

Manipulating XML strings directly is not recommended in most cases, but it does make sense in some since some transformations are really that simple.

The correct way of accomplishing this is to transform the XML InfoPath into the serialized version of the type that the web service expects and then send deserialze it into the WS's type. You transform from one type into another using XSL and a bit of code to do the transformation.

The problems with transforming using XSL include:


  • You need to know at least some XSL
  • Storage of the XSL
  • Changes in either the input or output require changes to the XSL


If you don't want to go with either approach, you do have one more option: extract the values you need from the InfoPath XML and copy the values into the type that the Web Service uses - sort of a manual transformation. You cold extract values from the InfoPath XML using XPath queries or just grab them using regular expressions or brute force string matches.

So, you have a few options. Your choice depends on how comfortable you are with the underlying approaches and whether you'll end up maintaining whatever you choose Wink | ;)

Erik Westermann - wWorkflow.net - Consulting Services

SOA * ESB * BPI ...and lots of other cool TLAs related to integration and architecture.




GeneralRe: Deserializing a xml document for sending it using a WebService Pin
beatles169216-Jun-08 20:06
beatles169216-Jun-08 20:06 
QuestionTime Format Pin
somagunasekaran15-Jun-08 18:51
somagunasekaran15-Jun-08 18:51 
AnswerRe: Time Format Pin
Syed Shahid Hussain15-Jun-08 18:56
Syed Shahid Hussain15-Jun-08 18:56 
GeneralRe: Time Format Pin
somagunasekaran15-Jun-08 19:04
somagunasekaran15-Jun-08 19:04 
GeneralRe: Time Format Pin
ginji2015-Jun-08 20:18
ginji2015-Jun-08 20:18 
AnswerRe: Time Format Pin
Nouman Bhatti15-Jun-08 21:03
Nouman Bhatti15-Jun-08 21:03 
AnswerRe: Time Format Pin
PIEBALDconsult16-Jun-08 5:47
mvePIEBALDconsult16-Jun-08 5:47 
Questioncodes for receiving fax data from 3 modem simultaneously to pc using c# Pin
ginji2015-Jun-08 17:35
ginji2015-Jun-08 17:35 
QuestionI did my home but need some tuning Pin
netJP12L15-Jun-08 16:09
netJP12L15-Jun-08 16:09 
AnswerRe: I did my home but need some tuning Pin
AB777115-Jun-08 16:23
AB777115-Jun-08 16:23 
AnswerRe: I did my home but need some tuning Pin
Christian Graus15-Jun-08 16:35
protectorChristian Graus15-Jun-08 16:35 
GeneralRe: I did my home but need some tuning Pin
netJP12L15-Jun-08 16:47
netJP12L15-Jun-08 16:47 
GeneralRe: I did my home but need some tuning Pin
AB777115-Jun-08 17:53
AB777115-Jun-08 17:53 
GeneralRe: I did my home but need some tuning Pin
netJP12L16-Jun-08 4:56
netJP12L16-Jun-08 4:56 
GeneralRe: I did my home but need some tuning Pin
AB777116-Jun-08 14:36
AB777116-Jun-08 14:36 
Questionupdating error using oledbcommandbuilder Pin
ginji2015-Jun-08 15:16
ginji2015-Jun-08 15:16 
AnswerRe: updating error using oledbcommandbuilder Pin
Christian Graus15-Jun-08 15:18
protectorChristian Graus15-Jun-08 15:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.