How to write custom serialization method in C# web service

Hi,

I have a C# web service client that talks to a JAVA application sever.
I use AXIS to generate the WSDL file, use wsdl.exe to generate proxy
stub c# code. When I try to use c# client connect to application
server, I did not get the result in the C# client side, I used a soap
monitor to look at the SOAP messages that were exchanged, I can see
server returned a correct SOAP message, but the C# client failed to
deserialize the XML result back to the C# object.

I wonder if there is a way to write a custom XML deserializer to
populate the result back to C# object. The serialization part seemed to
be ok.

The following is the proxy code generated by wsdl.exe:

public class CommandServerService :
System.Web.Services.Protocols.SoapHttpClientProtocol {

    /// <remarks/>
    public CommandServerService() {
        this.Url = "http://localhost:7001/services/CommandServer";
    }

    /// <remarks/>
    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
        [return:
System.Xml.Serialization.XmlElementAttribute("executeCommandReturn",
Namespace="http://webservice.foo.com")]
    public TargetableCommand
executeCommand([System.Xml.Serialization.XmlElementAttribute(Namespace="http://webservice.foo.com")]
string in0,
[System.Xml.Serialization.XmlElementAttribute(Namespace="http://webservice.foo.com")]
TargetCommand in1) {
        object[] results = this.Invoke("executeCommand", new object[] {
                    in0,
                    in1});
        return ((TargetCommand)(results[0]));
    }

   ....

}

The elements of "results[0]" are null.I used "Document/Literal" style
in wsdl document. I can get the result[0] with correct values populated
when I use "RP C encoding" style.

The generated proxy code does not tell me how System.Xml.Serialization
is called to handle serialization/deserialization, it seems that .Net
handles it automatically. I wonder how I can overwrite this behavoir by
supplying a custom serialization/deserialization method to populate the
result[0] with returning values. The following is the XML document
returned by the server:

<?xml version="1.0" encoding="utf-8"?>
   <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <soapenv:Body>
         <executeCommandReturn xsi:type="ns1:LoginCommand"
xmlns="http://webservice.foo.com" xmlns:ns1="http://foo.bar.com">
            <authenticationMethodId xsi:type="xsd:string"
xsi:nil="true"/>
            <authenticationState
xsi:type="xsd:string">authenticated</authenticationState>
            <authenticationStep xsi:type="xsd:string" xsi:nil="true"/>
            <hiddenParameters
xsi:type="ns2:ArrayOf_tns5_AbstractParameterDTO"
xmlns:ns2="http://webservice.rsa.com"/>
            <identitySourceGuid
xsi:type="xsd:string">000000000000000000001000d0011000</identitySourceGuid>
            <message xsi:type="ns3:MessageDTO" xsi:nil="true"
xmlns:ns3="http://data.authn.rsa.com"/>
            <netAddress xsi:nil="true"/>
            <parameters
xsi:type="ns4:ArrayOf_tns5_AbstractParameterDTO"
xmlns:ns4="http://webservice.rsa.com"/>
            <policyGuid xsi:type="xsd:string" xsi:nil="true"/>
            <principalGuid
xsi:type="xsd:string">ims.000000000000000000001000d0021000</principalGuid>
            <sessionId
xsi:type="xsd:string">b29b1b304358680a017385bef29f4efb-k0PBDzXeDhxF</sessionId>
            <usingTransientSession
xsi:type="xsd:boolean">false</usingTransientSession>
         </executeCommandReturn>
      </soapenv:Body>
   </soapenv:Envelope>

The values returned by the server are in the message, but the client
failed to deserialize the values into result[0], which is
"TargetCommand" objec.

I am new to C#, any advice is appricated.

Thanks

Reply

0
psy000 (1)
10/3/2005 5:18:06 AM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
1011 Views

Similar Articles

[PageSpeed] 25

Reply:

Similar Artilces:

Alternative Method to Entourage/Time Machine Backup
> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3341647233_86782 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: 8bit I don�t understand the instructions on the website beyond making an Entourage Backup folder and storing it outside of the MUD folder. The instructions seem contradictory, i.e., use step 3 but the further in the questions and answers that there is no need to have �folder actions.� Step 3 IS folder actions. I was very unsuccessful usi...

How to read B-LOB data from Oracel DB using Pro*c
Hello, I'm trying to read B-LOB data in Oracle Database using Pro*c. I know how to read it with char mode. What I want to know is read it with binary mode. Are there any good person help me? Let me know if you have a good sample source. Thanks and have a nice day. ...

Service Management should be attached to Payroll
i cant believe that service management has no attachment o Payroll. Service Management is all about using your labor efficiently. Certainly a module that focuses on labor should have an attachment to allow all labor entries to flow to the wekly payroll! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I...

Exchange Services #2
In the Services, Microsoft Exchange Event is failed to start even if we tried to manually start the service. What can we do about it and How? You can take a look in App Event log, if you do use Events service. jhon wrote: > In the Services, Microsoft Exchange Event is failed to start even if we tried to manually start the service. What can we do about it and How? -- Help fight spam - designate sending servers for your domain. http://spf.pobox.com ...

Pausing between edit box writes
I'm writing a VC++ 6.0 app. where I output messages on a text box using the CDialog class's DoDataExchange method. I do the following.... CString m_Display; m_Display = "First Display"; DoDataExchange(...) ::Sleep(4000); m_Display = "Second Display"; DoDataExchange(...); I expect to see "First Display", pause for 4secs, then "Second Display". However, I don't see the "First Display" at all - I just see a blank, and then "Second Display". What gives? What's another technique to do this? -Zilla There is...

Can't open properties for Internet email service
When adding an Internet email service to my Outlook client, the Internet email properties will not open. I click the properties button and nothing happens. I ran fixmapi.exe and nothing changed. Any ideas? ...

Endnote/Cite write, as well as database issues
Hello all- Is anyone using Endnote 7 on the mac and Office X? I have found some stability issues, as well as issues connecting to certain databases- e.g. Blackwell does not have a direct filter, you have to go through other steps. I am all ears (actually eyes) to talk with someone about this because I am writing my dissertation and think that the steep learning curve is worth it. Email : sethhalvorson@gmail.com ...

Custom application development/integration with MSCRM 1.2
Howdy, Integration of application with MS CRM needs us to find answers for the following questions: 1) Can we Insert and access our custom tables in the MSCRM DB? 2) Can we make our custom entity objects? 3) Are there any API calls available to access the custom tables in MSCRM DB? The answers to questions 1 and 3 is "Yes" with regard to SalesLogix, but as far as my knowledge of MSCRM is concerned, I could not find anything in the SDK taht would allow any of the above. But I am a complete newbie to MSCRM, and any input to the balove will be highly appreciated. Regards, Vik alter...

What's the best method for changing a username/email adress?
This is a multi-part message in MIME format. ------=_NextPart_000_003F_01C4B5E5.20E47D80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Admins! I'm a bit green at Exchange Administration as I run a SBS2000 and have = been learning much as I go. One of my users just got married and her name changed. So I need to = change both her username and email address. Do I recreate both afresh or = are there other ways to accompish my task? Can you tell me how to most do this following best practices? pheidippides ------=_NextPart_000_003F_0...

Custom charting
This may be difficult to explain but am going to try :) I need to track "Liaison Costs" and "Sorting Costs" by month. I also need to compare "Liaison Costs" to a budget and generate the difference on the chart for the given month, at the same time displaying a stacked bar that shows the "Liaison Costs" and "Sorting Costs". For example: Jan Feb Mar Liaison Costs 15,000 16,000 9,000 Sorting Costs 6,000 15,000 11,000 Budget 15,000 15,000 15,000 So now I need to plot the char...

Creating Custom Date format Q1-2009, etc.
Excel 2002 SP3 Win XP Pro SP2 Hi, How do I properly create a Darte format that will display: Q1-09 Q2-09 Q3-09 Q4-09 Q1-10 Q2-10 etc.? Q is of course for Quarter so Q1-09 is Jan to Mar 2009. Thanks! ="Q"&INT((MONTH(A1)+2)/3)&TEXT(A1,"-yy") -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "stef" <notvalid@nomail.nul> wrote in message news:%23CWOvqyyIHA.4492@TK2MSFTNGP02.phx.gbl... > Excel 2002 SP3 > Win XP Pro SP2 > > Hi, > > How do I properly create a Darte format that will dis...

Custom LDAP/OPATH query to create custom address list?
I'm going to ask this again because it seems to be a big problem going to exchange 2007. How does one create a custom LDAP query to an external server to build a custom address list? It would be nice to be able to create custom address lists built on LDAP queries to Active Directory or OpenLDAP, etc. Can this be done? Only recipients in Active Directory can appear in Address Lists. You would have to import external recipients into AD as Contacts to be able to do this. -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: exchangepedia.com/blog ------------------------...

how to customize pick list such as industry
I would like to know how to customize pick list such as industry code? We have seen that the pick list of the industry (branch) is two times in CRM. Once in the Leadmanagement and once in the Accountmanagement. They have to contain the same data, because when we convert a Lead in to an account, CRM takes the id of the industry from the Lead and puts it to the new account. If the id doesn't excist in the industry pick list, crm will not convert the lead correctly. In the formsetting i can't set the id of an industry code. How can I adapt this two Lists and how can I recover the old Da...

Item report by customer
We need to pull up a report in Store Operations that will cross reference an item sold and who purchased it. Is there any such report available?? POS Detailed Sales report, add the Customer column the left click and hold on the Customer column and drag it to the left of Department and drop. You now have a report by customer. Rob "POS" <POS@discussions.microsoft.com> wrote in message news:99574F12-D955-459F-845C-71659237964E@microsoft.com... > We need to pull up a report in Store Operations that will cross reference > an > item sold and who purchased it. > Is...

Unable to access method within iFrame, please help
Hi all, I've created a custom ASP page that pulls information from the SQL server and displays it in an iframe. The data is editable, and needs to be updated when the CRM form is saved. The page within the iframe has a javascript method called submit() that will update the information on the db. I want to call this method from the onSave event, but I can't figure it out. How do I get access to the methods that are part of the page within the iframe? A little background: CRM 3.0 Windows Server 2003 The page is asp .net created in visual studio 2005 Any help would be greatly appre...

customize comment
is it possible to remove the arrow on a comment? -- rp Would a textbox work for you, they remain visible as placed. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "rp" <rufinojr54@hotpop.com> wrote in message news:%233a%23PffxEHA.2788@TK2MSFTNGP15.phx.gbl... > is it possible to remove the arrow on a comment? > > -- > rp > > ...

Exchange 5.5 SP4
I have purposley avoided service pack 4 for 2000 server because of know issues that have occured with other applications. Has anyone else upgraded W2K to SP 4 and had any problems? Current configuration is as follows: W2K Server Running SP 3 Exchange 5.5 Running SP 4 Groupshield Exahnge 5 I'm hesitant to do so without some feed back from users. Thanks Be sure to take a look at :http://support.microsoft.com/?id=821543 I would also check with McAfee concerning any known issues and of course test in a lab. On Mon, 21 Feb 2005 11:25:04 -0800, "awreneau" <awreneau@d...

CRM Web site 10-28-06
I have a problem with remote access to the CRM Web site inspite of it works locally on the server so there is someone who can reply to this question to help me to resolve this problem? : 1-can I change the CRM Web site from default site to another new site without changing in the cusyttmoization of the CRM. What I forget to say is the manner of the failure of the remote access: When I type the URL and I submit, the first screen blue of CRM is displyed for a few millisenconds and then the browser is closed. What shall I conclude from that? Hi: Put your crm server in your local intrane...

i can't run my web application in windows7.
hi! i am MCPD.EA student i am using VS 2005 ,i have installed windows7 ,i can't run my web application; if i click on debug, it goes to web page and gives me an error that" internet explorer cannot display web page" please give me some suggestion??? On Nov 12, 1:34=A0pm, shavirak <shavi...@discussions.microsoft.com> wrote: > hi! i am MCPD.EA student > i am using VS 2005 ,i have installed windows7 ,i can't run my web applica= tion; > if i click on debug, > it goes to web page and gives me an error that" internet explorer cannot > dis...

Sort window for Custom Sort gets bigger each use
Our company recently rolled out Office 2007 Standard. One user uses Excel quite a lot. She does the Custom Sort action a lot (under the Home tab>Sort&Filter button). She noticed that the window that pops up actually increases in size each time she clicks the Custom Sort button. When I try it on my pc, I can resize the Sort window, and have it remember whatever size I put it at each time, whether I close and restart Excel, or just doing another Sort action. For her, it increases exponentially. The process goes like this: 1. Click Custom Sort 2. Click Cancel to close Sort window. ...

print quote for customer 08-27-07
When I Use the functionality "print quote for customer" for quotes with write in products added the chosen Word template opens but it's impossible to complete the merge because the mail merge wizard doesn't work normally. Furthermore when I go back to the quote form appears the message: "An Error has occurred. For more info contact your System Admin" Can anyone help me? Is it a bug or a mistake of mine? Thank you ...

Web Query Question
When using a web query, what does it show up as for the user agent , does it just show up as a IE browser? Cheers Saint? ...

toolbar customizing
When I add buttons to the toolbar they dissapear in a random fashion. they may stay on the bar for a few days or a week, but they always suddenly disappear. What can I do about this? Try renaming your outcmd.dat file to outcmd.old while Outlook is closed. Outlook will rebuild the default toolbars the next time you open it. If your changes to the toolbars "stick" after doing this, then you know it was the outcmd.dat file causing the problem. Make sure to make a backup of the new outcmd.dat file so you can restore it if you ever run into the same problem again. Note: If you'...

Write a Formula
How do I write a formula for penalty on past due accounts with great than or equal to 1000 but less than 5000, apply a penalty of $100. For accounts with a past due balance of 5000 or more, apply a penalty of 200. For accounts with a ttl past due balance of less than 1000, no penalty? Let A1 hold the past due amount =IF(A1>5000,200, IF(A1>=1000,100,0)) OR =(A1>=1000)*100 + (A1>5000)*100 best wishes -- Bernard Liengme Microsoft Excel MVP people.stfx.ca/bliengme email address: remove uppercase characters "Esperanza" <Esperanza@discussions.microso...

Customer Statement
How may I customize the customer statement? Good luck. Statements in MSM:SB are seriously broken At the core, Invoices are seriously flawed.. I'm not sure what MS thinks an invoice is and what information related to one is used for, but IT isn't what I NEED from a SMALL BUSINESS package.. I'm realizing that MSM:SB is a joke and statements in particular are a cruel joke. "xsintrick" wrote: > How may I customize the customer statement? > > ...