tags:

views:

42

answers:

1

Here is the code below

I tried this call but it didnt work... even if the function inside this call is empty i tried this exact function call with only 5 input parameters and it worked? Something is fishy here hopefully someone can suggest and if you have anyway i can minimize this code meaning the parameters passes im open for suggestions anytime.

Code below:

 [WebInvoke(UriTemplate = "customer/update/customerCode={customerCode}/customerName={customerName}/customerCountry={customerCountry}/customerTelephone={customerTelephone}/customerEmail={customerEmail}/customerCreditLimit={customerCreditLimit}/customerCommission={customerCommission}/customerRank={customerRank}/contactFullname={contactFullname}/contactBusinessPhone={contactBusinessPhone}/contactTimezone={contactTimezone}/contactActive={contactActive}/contactDepartment={contactDepartment}/contactHomePhoneExtension={contactHomePhoneExtension}/shipToCountry={shipToCountry}/shipToPaymentTerm={shipToPaymentTerm}/shipToCommissionPercent={shipToCommissionPercent}/shipToTruckSize={shipToTruckSize}/shipToTaxNumber={shipToTaxNumber}/shipToRouteCode={shipToRouteCode}/shipToOpenTime={shipToOpenTime}/shipToCloseTime={shipToCloseTime}", Method = "PUT", BodyStyle = WebMessageBodyStyle.Wrapped)]
        public void UpdateCustomer(string customerCode, string customerName, string customerCountry, string customerTelephone, string customerEmail,
                            string customerCreditLimit, string customerCommission, string customerRank, string contactFullname,
                            string contactBusinessPhone, string contactTimezone, string contactActive, string contactDepartment,
                            string contactHomePhoneExtension, string shipToCountry, string shipToPaymentTerm, string shipToCommissionPercent,
                            string shipToTruckSize, string shipToTaxNumber, string shipToRouteCode, string shipToOpenTime,
                            string shipToCloseTime)
        {
            // code or no code
        }

This is how I implement the function above:

using (HttpResponseMessage response = m_RestHttpClient.Put("customer/update/customerCode=CUST190/customerName=Ralph Lauren/customerCountry=United Kingdom/customerTelephone=1234567489/[email protected]/customerCreditLimit=1/customerCommission=5/customerRank=45/contactFullname=Diego Sin/contactBusinessPhone=911/contactTimezone=6/contactActive=True/contactDepartment=Sales/contactHomePhoneExtension=456/shipToCountry=Uganda/shipToPaymentTerm=NET30/shipToCommissionPercent=1/shipToTruckSize=50/shipToTaxNumber=777/shipToRouteCode=001/shipToOpenTime=10 am/shipToCloseTime=11pm", frm.CreateHttpContent()))
            {
                response.EnsureStatusIsSuccessful();
            }

Thanks

+1  A: 

You don't have a body parameter, PUT requires a body.

Beyond that, PUT is not equivalent to doing an Update stored procedure. Don't try and do this, it does not make any sense. All those parameters need to go in the body.

There are physical limits to URL length, so you may be running into an issue because of that.

Darrel Miller
Ok so can you please show me how can I implement this especially the Body parameter. Can you show me a simple example with lets say 4 fields...Where does the HttpContent needs to be used?and lastly what is the physical limit to the URL/URI link length? or maybe it can be expanded.. since I cant find any proper solution in the web/Microsoft.. Thank you very much for your inputs.Thanks
Ravi
I found out that 260 characters is the maximum limit of a URI string... So do you have any suggestions on how can I implement this with complex types?
Ravi