简体   繁体   中英

Calling a Java webservice from C# .NET Core (specifically Workday). How to get xml attributes in the soap request

I am trying to call Workday's web service in .net core c#. The service was written in Java. I'm having problems getting xml attributes to show up in my soap request.

Example: What I want it to look like:

...       
<wd:Usage_Data wd:Public="true">
    <wd:Type_Data wd:Primary="true">
        <wd:Type_Reference>
...

What it does look like:

...
<wd:Usage_Data>
   <wd:Type_Data>
      <wd:Type_Reference>
...

I cant get the wd:Public="true" to be there in the send request xml output. I am setting it in c#.

What I've done is create a WCF Service Reference to workday, and modified the Reference.cs to https://hr.dovetailsoftware.com/gcox/2014/06/13/getting-started-workday-web-services-using-c/ , and tried playing around with the xml serializer a bit, but no luck. Other workday services that don't have any attributes work just fine.

I'm sure its a simple fix but I cant find it. I can post more code if necessary. Thanks

Figured it out. I think it's a Wrokday thing. Posting here in case of anyone else. You actually need to set the "Specified" properties.

        phoneType.Usage_Data[0].Public = true; 
        //not good enough, you need to set this
        phoneType.Usage_Data[0].PublicSpecified = true;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM