Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Normal WebService works but same won't work when I convert to WEB API

$
0
0

In normal web service xml request works very well and converts as class object. Bust same code when I convert to WEB API it doesn't convert xml request as class object.

Below is the code for normal Web Service which is working currently:
From SOAP UI I call the webservice with below xml request file.
[WebMethod]
public Reply Order(Request user)
{
// XML request is successfully converting to Request class object

}


Below is the WEB API Controller and not converting XML request to class object:
From fiddler I am passing below xml(by removing soap:Envelope and soap:Body tag)

public class InquireController : ApiController
{
[HttpPost]
public Reply Order([FromBody] Request user)
{
// user is null
// XML request is not converting to Request class obejct instead it comes as null
}
}


Can you please help what might be the issue in WEB API or any changes I need to do for class etc...?

xml :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<testorder xmlns="http://www.test.com/test/testway/">
<userRequest>
<userRole>
<cCode />
<Identifier>2015423124346</Identifier>
</userRole>
<General_Info>
<ID>hpe_eprime_us</ID>
<Ref_No>1494813010537</Ref_No>
<GrandTotalAmount>100</GrandTotalAmount>
<Tok>sdkjfdfdfkksdkj</Tok>
<CurrencyCode>USD</CurrencyCode>
<IsManualTransaction>false</IsManualTransaction>
<IsPatternCall>false</IsPatternCall>
<IsRetry>false</IsRetry>
<Customer>
<FirstName>tester</FirstName>
<LastName>tester</LastName>
<Email>tester@tester.com</Email>
<Phone>2811231245</Phone>
<IPAddress>127.0.0.1</IPAddress>
<BillAddress>
<Address1>11040 Louetta Road signed_date_time=2017-02-15T03:00:36Z</Address1>
<City>Houston</City>
<State>TX</State>
<Zip>77070</Zip>
<Country>US</Country>
<CompanyName>Bill Company Name</CompanyName>
<ContactNightPhone>2811231245</ContactNightPhone>
</BillAddress>
</Customer>
</General_Info>
<Requests>
<ServiceRequired>true</ServiceRequired>
<Operation>Auth</Operation>
<RequestData>
<ItemRequestData>
<Processor>test</Processor>
<Amount>100</Amount>
<CreditCard>
<test_Token>sdnasdnadnknjqee</test_Token>
<test_Signature>WOcWTICm7mZUjY0QJKLr3bjtmdIa8Atxtkz4cjhTFc4=</test_Signature>
<test_Type>001</test_Type>
<test_Expyr>2020</test_Expyr>
<test_Expmo>11</test_Expmo>
<IsSaveProfile>false</IsSaveProfile>
<PGS_LinkID/>
<CCExpValue>283737599</CCExpValue>
</CreditCard>
</ItemRequestData>
</RequestData>
</Requests>
</userRequest>
</testorder>
</soap:Body>
</soap:Envelope>


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>