I am using ASP.NET and C# to display a form for someone to complete and submit a request to an external company on a button click. The company provided a WSDL file which i was able to import into my Solution as a Web Reference. Once I added the reference it generated a bunch of classes which appears to create an XML file and from what I understand is what I need to do. I given an example of what an XML file submittion looks like but I am a little confused on how to the web reference and submit the request.
Here is the WSDL
I am trying call the complextype (method) ClaimSubmittalRequest This is what I was able to do in my C# code (get and set the fields):
var submitClaim = new ThermalKing.SubmitClaimRequest
{
claimLanguage = "ENG",
serviceVersion = "1.0",
claimType = "PARTS",
failureDate = new DateTime(2014, 11, 26),
faultFound = "PERFORM A FREE INSPECTION"
};
var submitParts = new ThermalKing.eachPart
{
partNumber = "1234",
partPrice = 100.78,
partQuantity = 17
};
Here is what the example XML File looks like:
<soapenv:Envelope xmlns:soapenv="http://ift.tt/sVJIaE" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:get="http://ift.tt/1yEtCDJ">
<soapenv:Header/>
<soapenv:Body>
<get:getSubmitClaim>
<SubmitClaimRequest>
<buName>Thermo King TSA</buName>
<dealerNumber>P5358</dealerNumber>
<userName></userName>
<password></password>
<transactionType>WARRANTY</transactionType>
<claimType>Machine</claimType>
<inventorySerialNumber>6001061225</inventorySerialNumber>
<repairDate>2011-09-05T00:00:00.000-05:00</repairDate>
<failureDate>2011-09-05T00:00:00.000-05:00</failureDate>
<workOrderNumber>testProcede1</workOrderNumber>
<conditionsFound>test</conditionsFound>
<workPerformed>test</workPerformed>
<claimNotes>test claim notes</claimNotes>
<!-- will be optional fields in the future -->
<faultLocation>FF</faultLocation>
<faultFound>BLOWN/BURST</faultFound>
<failureDetail xsi:nil="true"/>
<smrClaim>N</smrClaim>
<forceToDraft>Y</forceToDraft>
<validateOnly>N</validateOnly>
<commercialPolicy>N</commercialPolicy>
<!-- will be optional fields in the future -->
<fuelSurcharge>0</fuelSurcharge>
<shopSupplies>0</shopSupplies>
<claimCurrency>USD</claimCurrency>
<workOrderSegment>1</workOrderSegment>
<claimLanguage>ENG</claimLanguage>
<serviceVersion>1.0</serviceVersion>
<partsType>
<!--1 or more repetitions:-->
<eachPart>
<partType>IRREMOVED</partType>
<partNumber>416780</partNumber>
<partQuantity>1.0</partQuantity>
<partPrice>1.23</partPrice>
<partDescription>test part desc</partDescription>
</eachPart>
<eachPart>
<partType>NONIR</partType>
<partNumber>1</partNumber>
<partQuantity>1.0</partQuantity>
<partPrice>1</partPrice>
<partDescription>test non IR</partDescription>
</eachPart>
<eachPart>
<partType>IRINSTALLED</partType>
<partNumber>416780</partNumber>
<partQuantity>1.0</partQuantity>
<partPrice>1</partPrice>
<partDescription>test ir installed</partDescription>
</eachPart>
</partsType>
<jobCodesType>
<!--1 or more repetitions:-->
<eachJobCode>
<jobCode>05051</jobCode>
<standardLaborHours>1</standardLaborHours>
<additionalLaborHours>.5</additionalLaborHours>
<laborRate>92.22</laborRate>
<ReasonForAdditionalLaborHours>test</ReasonForAdditionalLaborHours>
</eachJobCode>
</jobCodesType>
<usageMetersType>
<!--1 or more repetitions:-->
<eachUsageMeter>
<usageAmount>1661</usageAmount>
<usageType>HoursInService</usageType>
<usageUOM>HOURS</usageUOM>
</eachUsageMeter>
</usageMetersType>
</SubmitClaimRequest>
</get:getSubmitClaim>
</soapenv:Body>
</soapenv:Envelope>
How can I call the Complex Type Method in my C# code to send the request to the external company? Or is it easier just to create an XML file manually using C#?
No comments:
Post a Comment