You need to sign in to do that
Don't have an account?
call to external WebService failing (statuscode 404)
Hi All,
I am trying to connect to external webservice. I am using Jeff Dougloas blog as referencehttp://blog.jeffdouglas.com/2009/03/16/restful-web-service-callout-using-post/
I created a new remote site.
Below is the class:
I am executing it by running following code in Execute Anonymous Window
15:36:13:427 USER_DEBUG [17]|DEBUG|System.HttpResponse[Status=Not Found, StatusCode=404]
I would appreciate any help.
I am trying to connect to external webservice. I am using Jeff Dougloas blog as referencehttp://blog.jeffdouglas.com/2009/03/16/restful-web-service-callout-using-post/
I created a new remote site.
Below is the class:
public class WebServiceCallout { //@future (callout=true) public static void sendNotification(String territories, String searchText) { HttpRequest req = new HttpRequest(); HttpResponse res = new HttpResponse(); Http http = new Http(); req.setEndpoint('https://pelcosales.schneider-electric.com/Administration/SalesForceServices'); req.setMethod('POST'); req.setBody('territories='+EncodingUtil.urlEncode(territories, 'UTF-8')+'&searchText='+EncodingUtil.urlEncode(searchText, 'UTF-8')); //req.setCompressed(true); // otherwise we hit a limit of 32000 try { res = http.send(req); System.debug(res.toString()); } catch(System.CalloutException e) { System.debug('Callout error: '+ e); System.debug(res.toString()); } } // run WebServiceCallout.testMe(); from Execute Anonymous to test /*public static testMethod void testMe() { WebServiceCallout.sendNotification('My Test Customer','My City'); }*/ }
I am executing it by running following code in Execute Anonymous Window
WebServiceCallout.sendNotification('17','360 Advanced Security Corporation');I am getting error message :
15:36:13:427 USER_DEBUG [17]|DEBUG|System.HttpResponse[Status=Not Found, StatusCode=404]
I would appreciate any help.
Gaurav, I made an alternative version of Wsdl2Apex and presented it at Dreamforce '14 - Improved Apex support for SOAP based web services (http://http://www.fishofprey.com/2014/11/dreamforce-2014-presentation-improved.html). It offers improved support for certain WSDL features and can ignore irrelevant features (like extra ports).
Good luck!
All Answers
I tried posting the body: to that URL and got a 404 response back from the web server.
It seems more like the web service isn't at that URL.
Wish me luck :(
Gaurav, I made an alternative version of Wsdl2Apex and presented it at Dreamforce '14 - Improved Apex support for SOAP based web services (http://http://www.fishofprey.com/2014/11/dreamforce-2014-presentation-improved.html). It offers improved support for certain WSDL features and can ignore irrelevant features (like extra ports).
Good luck!
Thanksfor the information. I downloaded WSDL2Apex. Amazing tool... However, I am still getting error message when I deploy apex class public class tempuriOrg .
Error: Apex Classes were not deployed. Original error:
Error StatusCode:INVALID_FIELD_FOR_INSERT_UPDATE
Failed to save 1 new sObject(s)
0:Error INVALID_FIELD_FOR_INSERT_UPDATE - Invalid type: schemasDatacontractOrg200407PelcoSa.ArrayOfCompanyModel
Successfully saved 0 records.
Data:
Operation: Deployed
Here is WSDL file
Hi Gaurav,
I was able to deploy the generated apex classes from the WSDL using our FuseIT tool.
Make sure you are either using the "Deploy All Apex Classes to Salesforce" button or that you deploy the schemasDatacontractOrg200407PelcoSa class first. It will have it's own tab next to tempUrlOrg (assuming you haven't renamed the namespace to class name mapping.
I saw the two error reports you submitted. Are you still having issues with WebServiceCallout.invoke?
Regards,
Daniel
I am still having issues. I am using version v2.9.0.143. I am deploying it in sandbox.
Error: Compile Error: Method does not exist or incorrect signature: WebServiceCallout.invoke(tempuriOrg.BasicHttpBinding_IPartnerAdvantageService, tempuriOrg.FindCompanies_element, Map<String,tempuriOrg.FindCompaniesResponse_element>, List<String>) at line 22 column 13 i.e.
WebServiceCallout.invoke(
Try renaming your existing WebServiceCallout class to something else before saving the Wsdl2Apex output.
That did solve the problem. Thankyou Daniel!!! you are the man!!!
Is the xsd.attribute supported in WebServiceCallout.invoke method? It seems the XML is not generated properly when there is an attribute associated with a complex type.