You need to sign in to do that
Don't have an account?
Jason Gelsomino 9
Webservice Call to external system using APEX
Hello,
I am trying to create a webservice call to an external system using APEX. I went and created the class from the WSDL using Fuse It. Then I created the VF page where I added a simple text input field and a output field for the response. I am having difficulty writing the controller to make this all work.
Here is the code I have thus far:
VF Page
Class generated by Fuse IT
Any thoughts would be appreciated!!!!
Thanks
I am trying to create a webservice call to an external system using APEX. I went and created the class from the WSDL using Fuse It. Then I created the VF page where I added a simple text input field and a output field for the response. I am having difficulty writing the controller to make this all work.
Here is the code I have thus far:
VF Page
<apex:page controller="WebserviceCall"> <apex:form > <apex:pageBlock > <apex:commandButton action="[!hello}" value="Initiate Webservice Call"/> <br/><br/> Drug Name: <apex:inputText value="{!ListProductNames}"/> <br/><br/> Product Name Output -- <apex:outputText value="{!ListProductNames}"/> </apex:pageBlock> </apex:form> </apex:page>Controller
public with sharing class WebserviceCall { public String ListProductNames { get; set; } public String productName { get; set; } public Double message {get; private set;} public PageReference hello() { gsddGoldstandardCom.ListProductNames stub = new gsddGoldstandardCom.ListProductNames(); message = stub.ListProductNames(productName ); return null; } }
Class generated by Fuse IT
public gsddGoldstandardCom.ListProductNames_element ListProductNames(String NameFilter,Integer MaxResultsReturned) { gsddGoldstandardCom.ListProductNamesRequest_element request_x = new gsddGoldstandardCom.ListProductNamesRequest_element(); gsddGoldstandardCom.ListProductNames_element response_x; request_x.NameFilter = NameFilter; request_x.MaxResultsReturned = MaxResultsReturned; Map<String, gsddGoldstandardCom.ListProductNames_element> response_map_x = new Map<String, gsddGoldstandardCom.ListProductNames_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, 'urn:ListProductNames', 'http://gsdd.goldstandard.com/', 'ListProductNamesRequest', 'http://gsdd.goldstandard.com/', 'ListProductNames', 'gsddGoldstandardCom.ListProductNames_element'} ); response_x = response_map_x.get('response_x'); return response_x; }
Any thoughts would be appreciated!!!!
Thanks
Can you publish your Web service class (full code) that you have generated from WSDL file?
This will help in understanding the response type of the Web service call.
In first look your web method seems to be returning a type gsddGoldstandardCom.ListProductNames_element, but you are assigning it to a Double.