• cheenath
  • NEWBIE
  • 219 Points
  • Member since 2005

  • Chatter
    Feed
  • 6
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 377
    Replies

I'm having some difficulty wrapping my head around the HttpRequest function, was hoping someone could push me along.

 

I'm trying to forward some key information to my web database on every save of a single custom object. My understanding was that using HttpRequest would be similar to sending a form to the page and I would be able to parse the array values there.

 

My difficulty is understanding how to tell the HttpRequest which Object I want it to function off of and more importantly how to identify which fields to send.

 

Given the code in the reference book I commented my confusions:

 

public class AuthCallout {
   public void basicAuthCallout(){
      HttpRequest req = new HttpRequest();
      req.setEndpoint('http://www.yahoo.com'); //OK, So I obviously changed this to my website

      req.setMethod('GET');  //I'd prefer a POST, but GET is fine

      // Specify the required user name and password to access the endpoint
      // As well as the header and header information
      String username = 'myname';  //I don't need this, I plan to use other means of authentication

      String password = 'mypwd';     //I don't need this, I plan to use other means of authentication
      Blob headerValue = Blob.valueOf(username + ':' + password); //don't need this either
      String authorizationHeader = 'BASIC ' +                                   //don't need, right?

      EncodingUtil.base64Encode(headerValue);                               //do I need? I don't know.

      req.setHeader('Authorization', authorizationHeader);               //still don't need

     // Create a new http object to send the request object
      // A response object is generated as a result of the request
      Http http = new Http();            //WHAT is this?

      HTTPResponse res = http.send(req); //I don't need a response
      System.debug(res.getBody());         // I don't need this either

   }
}

 

This leaves my code at a very confusing:

 

public class AuthCallout {
   public void basicAuthCallout(){
      HttpRequest req = new HttpRequest();
      req.setEndpoint('http://www.myurl.com');

      req.setMethod('GET'); 

      Http http = new Http(); /maybe?

  }

}

 

So either I want to make a dynamic URL:

req.setEndpoint('http://www.myurl.com?name=a.name__c&phone=a.phone__c&etc=et_cetera__c');

 

OR

 

somewhere else I need to define my array variables

 

Can someone help me with this? I would be very appreciative.

Hi,

 

We have a scontrol that calls an apex webservice by the API an it was working fine until some days ago that it started to retrieve the following error message (not all the time):

 

 

ERROR: ........... {faultcode:'soapenv:Server', faultstring:'Unable to deserialize inputstream', }

 

This is the summary of the scontrol code:

 

 

<script src="/soap/ajax/13.0/connection.js"></script>
<script src="/soap/ajax/13.0/apex.js"></script>
<Script language="JavaScript">
// here goes another code
function callWS(){
var process = sforce.apex.execute('MyApexWebservice', 'Method1',{param1:1, starting: var_mystart, param2: var_for_param2, param3: var_for_param3 },
function(result){
// here is another logic according to the received result.
if(result[0]!='0'){
// If process hasn´t finished yet it is recalled for next iteration
var_mystart = result[0];
settimeout("callWS();",90);
}
});
}
</script>

 

 

 So now,

 

1: I would like to know what does that error message means? It seems to be a Server side problem.

2. Is there any possible way to catch that error? I already tried to add the "try catch" sentence to the scontrol and to the apex webservice but in none place it is catched.

 

I'd like to catch that kind of error message so I could implement a RETRY method.

 

Thanks to all of you who could help me.

 

Regards,

 

Wilmer

 

 

Message Edited by Wilmer on 05-16-2009 09:02 AM

I have a global class, which has two Methods, and each performs a different out call function,

should each method has a @future annotation?

 

for example,

 

global class PerformOutcall {

 

     @future (callout=true)

       public static void OutCallRun1() {              WS.ServiceSoap dns =

new WS.ServiceSoap();

              dns.Webservice1();

     }

 

     @future (callout=true)

      public static void OutCallRun2() {              WS.ServiceSoap dns =

new WS.ServiceSoap();

              dns.Webservice2();

     }

 

 

}

  • February 11, 2009
  • Like
  • 0
Hello,
 
Trying to generate an Apex class from the following WSDL :
 
WSDL :
<—xml version="1.0"–>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
 name="FLAMericaService"
 targetNamespace="http://fla.merica-us.net/coreBaseObjects"
 xmlns="http://schemas.xmlsoap.org/wsdl/"
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 xmlns:tns="http://fla.merica-us.net" 
 xmlns:s="http://fla.merica-us.net/coreBaseObjects"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:xml-soap="http://xml.apache.org/xml-soap">
 
 <wsdl:types>
  
  
  <xsd:schema elementFormDefault="qualified"
   targetNamespace="http://fla.merica-us.net/coreBaseObjects">
   <xsd:element name="GetHealthProfile">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element minOccurs="1" maxOccurs="1" name="name" type="s:TXLifeRequest"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   
   <xsd:element name="GetHealthProfileResponse">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element minOccurs="1" maxOccurs="1"
       name="GetHealthProfileResult" type="xsd:string"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   
   <!-- GetPrescriptionHistory starts here-->
   <xsd:element name="GetPrescriptionHistory">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element minOccurs="1" maxOccurs="1" name="TXLifeRequest" type="s:TXLifeRequest"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="GetPrescriptionHistoryResponse">
    <xsd:complexType>
     <xsd:sequence>
      <xsd:element minOccurs="1" maxOccurs="1"
       name="GetPrescriptionHistoryResult" type="s:TXLifeResponse"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <!-- GetPrescriptionHistory ends here-->
   
  </xsd:schema>
  
  
  <s:schema xmlns="http://www.w3.org/2001/XMLSchema"
   xmlns:typens="urn:XXXXXAddressFetcher2"
   targetNamespace="http://fla.merica-us.net/coreBaseObjects">
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   
   <complexType name="TXLifeRequest">
    <all>
     <element name="OLifE" type="s:oLifE" nillable="true"/>
     <element name="TransRefGUID" type="string" nillable="true"/>
     <element name="TransType" type="int" nillable="true"/>
     <element name="TransExeDate" type="string" nillable="true"/>
     <element name="TransExeTime" type="string" nillable="true"/>
     <element name="TransMode" type="string" nillable="true"/>
     <element name="TestIndicator" type="int" nillable="true"/>
    </all>
   </complexType>
   
   <complexType name="TXLifeResponse">
    <all>
     <element name="TransResult" type="s:transResult"
      nillable="true"/>
     <element name="OLifE" type="s:oLifE" nillable="true"/>
     <element name="TransRefGUID" type="string" nillable="true"/>
     <element name="TransType" type="int" nillable="true"/>
     <element name="TransExeDate" type="string" nillable="true"/>
     <element name="TransExeTime" type="string" nillable="true"/>
     <element name="TransMode" type="string" nillable="true"/>
     <element name="TestIndicator" type="int" nillable="true"/>
     <element name="TXLifeResponseOLifEExtension"
      type="s:TXLifeResponseOLifEExtension" nillable="true"/>
    </all>
   </complexType>
   
..............  
... Deleted the detailed echma detail because of the limitation of size..
 <!-- GetHelloMsg messages starts here-->
 <wsdl:message name="GetHealthProfileSoapIn">
  <wsdl:part name="parameters" element="s:GetHealthProfile"/>
 </wsdl:message>
 <wsdl:message name="GetHealthProfileSoapOut">
  <wsdl:part name="parameters" element="s:GetHealthProfileResponse"/>
 </wsdl:message>
 
 <!-- GetHelloMsg messages ends here-->
 
 <!-- GetPrescriptionHistory messages starts here-->
 <wsdl:message name="GetPrescriptionHistorySoapIn">
  <wsdl:part name="parameters" element="s:GetPrescriptionHistory"/>
 </wsdl:message>
 <wsdl:message name="GetPrescriptionHistorySoapOut">
  <wsdl:part name="parameters" element="s:GetPrescriptionHistoryResponse"/>
 </wsdl:message>
 <!-- GetPrescriptionHistory messages ends here-->
 
 
 
 <!--  porttype starts here-->
 <wsdl:portType name="FlaMericaServiceSoap">
  
  <wsdl:operation name="GetHealthProfile">
   <wsdl:input message="s:GetHealthProfileSoapIn"/>
   <wsdl:output message="s:GetHealthProfileSoapOut"/>
  </wsdl:operation>
  
  <wsdl:operation name="GetPrescriptionHistory">
   <wsdl:input message="s:GetPrescriptionHistorySoapIn"/>
   <wsdl:output message="s:GetPrescriptionHistorySoapOut"/>
  </wsdl:operation>
  
  
 </wsdl:portType>
 <!-- porttype ends here-->
 
 
 <wsdl:binding name="FlaMericaServiceSoap" type="s:FlaMericaServiceSoap">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
   style="document"/>
  <!-- GetHelloMsg operation starts here-->
  <wsdl:operation name="GetHealthProfile">
   <soap:operation
    soapAction="http://localhost:8080/doclit/sample/services/FLAWebService/GetHelloMsg"
    style="document"/>
   <wsdl:input>
    <soap:body use="literal"/>
   </wsdl:input>
   <wsdl:output>
    <soap:body use="literal"/>
   </wsdl:output>
  </wsdl:operation>
  <!-- GetHelloMsg operation ends here-->
  
  <!-- GetPrescriptionHistory operation starts here-->
  
  <wsdl:operation name="GetPrescriptionHistory">
   <soap:operation
    soapAction="http://localhost:8080/hannover/merica-us/services/FLAWebService/GetPrescriptionHistoryReport"
    style="document"/>
   <wsdl:input>
    <soap:body use="literal"/>
   </wsdl:input>
   <wsdl:output>
    <soap:body use="literal"/>
   </wsdl:output>
  </wsdl:operation>
  
  <!-- GetPrescriptionHistory operation ends here-->
  
 </wsdl:binding> 
 
 
 <wsdl:service name="FlaMericaService">
  <wsdl:port name="FLAWebService" binding="s:FlaMericaServiceSoap">
   <soap:address
    location="http://localhost:8080/hannover/merica-us/services/FLAWebService"/>
  </wsdl:port>
 </wsdl:service>
 
</wsdl:definitions>

 
The WSDL is stored on my local hard disk ..
 
Force.come could parse the WSDL but while generating the code I got the following error :
Error: Unable to find complexType for {http://fla.merica-us.net/coreBaseObjects}TXLifeRequest
 
Am I missing some thing.
 
Thanks & Regrds
Sanghamitra
 
  • September 10, 2008
  • Like
  • 0
I've seen examples demonstrating how to invoke an Apex Web Service from inside the Ajax toolkit, but these only show simple parameter types

result = sforce.apex.execute('MyClass' ,'methodX',{role:"User", firstname "Joe", lastname "Test");

But what how do you pass complex parameters to the Web Service???

For sake of example, lets say you have the following Apex Class Definitions:

global class MyClass {
    WebService static String methodX(String role, ContactX contact) {
        return (role + ': '+ contact.firstname + ' ' + contact.lastname);   
    }
}


and

global class ContactX {
    public String firstname;
    public String lastname;
}



How would you invoke methodX, passing in an instance of the ContactX class?   I tried the following approaches - but had no luck ...

    result = sforce.apex.execute('MyClass' ,'methodX',{role:"User", contact:{firstname:"Joe", lastname:"Test"} });

    // null values for firstname and lastname are returned


and

    var newcontact = new sforce.Xml("ContactX");
    newcontact.firstname = "Joe";
    newcontact.lastname = "Test":
    result = sforce.apex.execute('MyClass' ,'methodX',{role:"User", contact:newcontact });

    //  soapenv:Client ->  There is no public member called 'firstname' in the Apex class 'ContactX'

Any suggestions?

Thanks,




Hi,
I'm new to Apex development. 
I used the "Generate From WSDL" option to create an Apex class to access our WebService.
The WebService is fairly large, the generated class came in just under the limit at 95k characters.
When I went to deploy this class from my Sandbox to our production environment (using Apache Ant),
I received an error saying 0% of my class was covered by Unit Tests.
Now, I wrote a test, but it gave a warning saying:
"Testmethods do not support webservice callouts".
So essentially Unit Tests for this class are just fillers to get past the 75% restriction.
At 95k characters, I'm looking at a lot of empty Unit Tests to get this code deployed on our production environment.
Is there currently any way to deploy an auto-generated apex class w/o writing Unit Tests?
Thanks in advance.

I also posted this under the REST API Integration Discussion board, but not sure if that's where it belongs, so here we go:

 

I'm trying to develop a solution in Java that uses the Bulk API to import objects into SalesForce and I'm following the Bulk API developers guide (located here: http://www.salesforce.com/us/developer/docs/api_asynch/index.htm).

 

In the example, references are made to a BulkConnection class.  I can't get this class to resolve...

 

I'm using the wsc-20.jar and the partner.jar generated from our Partner WSDL, but I can't find BulkConnection anywhere.

 

Any ideas? Thanks in advance!

  • May 19, 2011
  • Like
  • 0

Hi All,

 

:smileysad::smileysad:

 

I am trying to use Bulk API instead of dataloader for loading bulk data into salesforce.
In Bulk API Developer's Guide , The following steps are mentioned to create a JAR file
of partner wsdl using wsc-18.jar file and to include both the jar files in library.

 

To download the Salesforce.com WSC toolkit:

1. Browse to http://code.google.com/p/sfdc-wsc/
2. Click the Downloads tab.
3. Click the wsc-18.jar link and save the file to a local directory.
The Bulk API does not provide a login operation, so you must use the SOAP Web services API to login.

To download the partner WSDL and compile it to Java classes with the WSC toolkit:
1. Log in to your Developer Edition Salesforce.com account. You must log in as an administrator or as a user who has the
“Modify All Data” permission. Logins are checked to ensure they are from a known IP address. For more information,
see “Setting Login Restrictions” in the Salesforce.com online help.
2. Navigate to Setup ? Develop ? API.
3. Right-click Partner WSDL to display your browser's save options, and save the partner WSDL to a local directory. For
information about the partner WSDL, see Using the Partner WSDL.
4. Compile the partner API code from the WSDL using the WSC compile tool:
java -classpath pathToJar\wsc.jar com.sforce.ws.tools.wsdlc pathToWSDL\wsdlFilename
.\wsdlGenFiles.jar


For example, if wsc.jar is installed in C:\salesforce\wsc, and the partner WSDL is saved to
C:\salesforce\wsdl\partner:
java -classpath C:\salesforce\wsc\wsc-18.jar com.sforce.ws.tools.wsdlc
C:\salesforce\wsdl\partner\partner.wsdl .\partner.jar
wsc.jar and the generated partner.jar are the only libraries needed in the classpath for the code examples in the
following sections.

 

Now when i try running the wsc-18 jar file in jdk1.6 using commandprompt or eclipse , its throwing the exception -
java.lang.ClassFormatError: LVTT entry for 'ent' in class file com/sforce/ws/transport/JdkHttpTransport does not match any LVT entry
at java.lang.ClassLoader.defineClass1(Native Method)

(JdkHttpTransport is a class in com.sforce.ws.transport package of wsc-18 jar)
 
if i run the wsc-18 jar in jdk1.5 , its throwing the exception - java.lang.unsupportedclassversionerror.

Please help me in solving this issue.

:smileysad:

 

TIA

- Sushupsi 

The WSDL I am generating through WSDL2Apex does not include the necessary SOAP Headers. Is there anyway to modify the generated apex code to include the SOAP Header properties? If so, how do I do that? I see the inputHttpHeaders__x but I am looking for the equivalent for SOAP Headers (if they exist)? 

 

 

Message Edited by Drew1815 on 08-07-2009 02:48 PM

I generated an Apex class via WSDL2Apex, and I'm trying to debug an issue with maintaining session headers.  Regarding the section that talks about outputting headers here http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts

 

the  outputHttpHeaders_x Map is null, and it doesn't appear to do anything beside being created in the class.  How can I tewak the callout to actually write the header information to this Map so I can access and reuse the session header?

 

Here's the generated code snippet I'm trying to debug:

 

//Generated by wsdl2apex public class InstranetSession { public class logout_element { private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{}; } public class loginResponse_element { private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{}; } public class SessionServiceHttpPort { public String endpoint_x = 'https://hidden/kblive/ccil/services/SessionService'; public Map<String,String> inputHttpHeaders_x; public Map<String,String> outputHttpHeaders_x; public String clientCert_x; public String clientCertPasswd_x; public Integer timeout_x; private String[] ns_map_type_info = new String[]{'http://services.instranet.com', 'InstranetSession'}; public void login(String userLogin,String password) { InstranetSession.login_element request_x = new InstranetSession.login_element(); InstranetSession.loginResponse_element response_x; request_x.userLogin = userLogin; request_x.password = password; Map<String, InstranetSession.loginResponse_element> response_map_x = new Map<String, InstranetSession.loginResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, '', 'http://services.instranet.com', 'login', 'http://services.instranet.com', 'loginResponse', 'InstranetSession.loginResponse_element'} ); response_x = response_map_x.get('response_x'); } public void acceptLanguage(String languages) { InstranetSession.acceptLanguage_element request_x = new InstranetSession.acceptLanguage_element(); InstranetSession.acceptLanguageResponse_element response_x; request_x.languages = languages; Map<String, InstranetSession.acceptLanguageResponse_element> response_map_x = new Map<String, InstranetSession.acceptLanguageResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, '', 'http://services.instranet.com', 'acceptLanguage', 'http://services.instranet.com', 'acceptLanguageResponse', 'InstranetSession.acceptLanguageResponse_element'} ); response_x = response_map_x.get('response_x'); } public void logout() { InstranetSession.logout_element request_x = new InstranetSession.logout_element(); InstranetSession.logoutResponse_element response_x; Map<String, InstranetSession.logoutResponse_element> response_map_x = new Map<String, InstranetSession.logoutResponse_element>(); response_map_x.put('response_x', response_x); WebServiceCallout.invoke( this, request_x, response_map_x, new String[]{endpoint_x, '', 'http://services.instranet.com', 'logout', 'http://services.instranet.com', 'logoutResponse', 'InstranetSession.logoutResponse_element'} ); response_x = response_map_x.get('response_x'); } } public class acceptLanguageResponse_element { private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{}; } public class ServiceError { public String errorType; public String message; private String[] errorType_type_info = new String[]{'errorType','http://services.instranet.com','ServiceErrorType','0','1','true'}; private String[] message_type_info = new String[]{'message','http://www.w3.org/2001/XMLSchema','string','0','1','true'}; private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{'errorType','message'}; } public class login_element { public String userLogin; public String password; private String[] userLogin_type_info = new String[]{'userLogin','http://www.w3.org/2001/XMLSchema','string','1','1','true'}; private String[] password_type_info = new String[]{'password','http://www.w3.org/2001/XMLSchema','string','1','1','true'}; private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{'userLogin','password'}; } public class acceptLanguage_element { public String languages; private String[] languages_type_info = new String[]{'languages','http://www.w3.org/2001/XMLSchema','string','1','1','true'}; private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{'languages'}; } public class logoutResponse_element { private String[] apex_schema_type_info = new String[]{'http://services.instranet.com','true','true'}; private String[] field_order_type_info = new String[]{}; } }

 

 

 Can anyone tell me why the response headers aren't being written to the map and/or how to resolve this hole in teh WSDL2Apex generated code?  And, also, where oh where is the documentation on the WebServiceCallout Apex class? 

 

 

Hi,

 

Please help!

I’ve created a veeeeery simple APEX class:

 

 

public class test { public boolean testMethod(){ return true; } }

 


 

The testMethod needs to be called when I press a button (custom button) with JavaScript Behaviour:

 

{!requireScript("/js/functions.js")}
{!requireScript("/soap/ajax/13.0/connection.js")}
{!requireScript("/soap/ajax/13.0/apex.js")}
var answer = confirm("Are you sure you want get Open Positions for this epic?")
if (answer){
alert(sforce.apex.execute("test","test", {}));
} else {}

 

But I have got the following error:

 

 

No operation available for request

{http://soap.sforce.com/schemas/class/test}testMethod.

 

 


 

 

 

  • August 04, 2009
  • Like
  • 0

Hi,

 

We have one application which calls external web services in apex code. It is working fine and i am getting response back.

 

Now we are looking for implementing compression using "setCompressed()" method / gzip compression. We have set compression using this method and now i am getting "BAD REQUEST - 400" response from web service. Any thoughts?

 

Thanks in advance.

 

V.R.

Hi all, I have problems calling a web service using the POST method. I think that I have the idea of how to do it...:S but Im not sure. Here is my code

 

 

public static String sendContent(String url,String parameters)
{
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(url); //this is the http://myws/
req.setMethod('POST');
req.setBody(parameters);this is like parameters="var1=value1&var2=value2&var3=value3"

req.setHeader('Content-type', 'application/x-www-form-urlencoded');
req.setHeader('Content-length', String.valueOf(parameters.length()) );
HttpResponse res = h.send(req);
return res.getBody();
}

 

 

Now when i execute this the res.getBody() throws me the following error:

 

 <?xml version='1.0' encoding='ISO-8859-1' ?> <SOAP-ENV:Envelope> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Unknown exception</faultstring> <faultactor>server name:listen port</faultactor> <detail><appSpecific>Unknown Exception has occurred</appSpecific> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

 

 I don't really know if I'm setting the headers correctly or what is missing so Ill really appreciate your help.

 

Thank you for your time 

I'm having some difficulty wrapping my head around the HttpRequest function, was hoping someone could push me along.

 

I'm trying to forward some key information to my web database on every save of a single custom object. My understanding was that using HttpRequest would be similar to sending a form to the page and I would be able to parse the array values there.

 

My difficulty is understanding how to tell the HttpRequest which Object I want it to function off of and more importantly how to identify which fields to send.

 

Given the code in the reference book I commented my confusions:

 

public class AuthCallout {
   public void basicAuthCallout(){
      HttpRequest req = new HttpRequest();
      req.setEndpoint('http://www.yahoo.com'); //OK, So I obviously changed this to my website

      req.setMethod('GET');  //I'd prefer a POST, but GET is fine

      // Specify the required user name and password to access the endpoint
      // As well as the header and header information
      String username = 'myname';  //I don't need this, I plan to use other means of authentication

      String password = 'mypwd';     //I don't need this, I plan to use other means of authentication
      Blob headerValue = Blob.valueOf(username + ':' + password); //don't need this either
      String authorizationHeader = 'BASIC ' +                                   //don't need, right?

      EncodingUtil.base64Encode(headerValue);                               //do I need? I don't know.

      req.setHeader('Authorization', authorizationHeader);               //still don't need

     // Create a new http object to send the request object
      // A response object is generated as a result of the request
      Http http = new Http();            //WHAT is this?

      HTTPResponse res = http.send(req); //I don't need a response
      System.debug(res.getBody());         // I don't need this either

   }
}

 

This leaves my code at a very confusing:

 

public class AuthCallout {
   public void basicAuthCallout(){
      HttpRequest req = new HttpRequest();
      req.setEndpoint('http://www.myurl.com');

      req.setMethod('GET'); 

      Http http = new Http(); /maybe?

  }

}

 

So either I want to make a dynamic URL:

req.setEndpoint('http://www.myurl.com?name=a.name__c&phone=a.phone__c&etc=et_cetera__c');

 

OR

 

somewhere else I need to define my array variables

 

Can someone help me with this? I would be very appreciative.

I have installed Ajax Toolkit in to my Salesforce account but when I try to look in to the Samples, nothing is getting displayed. Actually there should be a Samples list that has to be displayed on the left navigation frame which is not getting displayed. I am currently using Firefox 3.0.

 

Can you please help me??

Message Edited by vkmedi on 05-19-2009 10:16 AM

Hi,

 

We have a scontrol that calls an apex webservice by the API an it was working fine until some days ago that it started to retrieve the following error message (not all the time):

 

 

ERROR: ........... {faultcode:'soapenv:Server', faultstring:'Unable to deserialize inputstream', }

 

This is the summary of the scontrol code:

 

 

<script src="/soap/ajax/13.0/connection.js"></script>
<script src="/soap/ajax/13.0/apex.js"></script>
<Script language="JavaScript">
// here goes another code
function callWS(){
var process = sforce.apex.execute('MyApexWebservice', 'Method1',{param1:1, starting: var_mystart, param2: var_for_param2, param3: var_for_param3 },
function(result){
// here is another logic according to the received result.
if(result[0]!='0'){
// If process hasn´t finished yet it is recalled for next iteration
var_mystart = result[0];
settimeout("callWS();",90);
}
});
}
</script>

 

 

 So now,

 

1: I would like to know what does that error message means? It seems to be a Server side problem.

2. Is there any possible way to catch that error? I already tried to add the "try catch" sentence to the scontrol and to the apex webservice but in none place it is catched.

 

I'd like to catch that kind of error message so I could implement a RETRY method.

 

Thanks to all of you who could help me.

 

Regards,

 

Wilmer

 

 

Message Edited by Wilmer on 05-16-2009 09:02 AM

For those who use asynchronous apex what is your average time between when the job is submitted and it completes. The documentation says that these jobs will execute when system resources are available but from what I can tell they execute almost instantly after submission. I'm sure this is not a safe assumption, especially with batch processing coming, as this could definitely cause an increase in queue times.

So has anyone noticed a significant delay between aschrounous submission time and completion time?

Thanks,
Jason

Message Edited by TehNrd on 02-28-2009 04:58 PM
  • February 27, 2009
  • Like
  • 0

I am getting this error while creating apex from WSDL.

 

Apex generation failed.

Error message:

Error: Unable to find schema for element; calculateFibonacciRangeReturn
 
where  'calculateFibonacciRangeReturn' is a method in the WSDL.
 
parsing is done with 0 errors,0 warnings, but next step generate apex is giving this error.
 
This WSDL is created from a java package using axis. Then I changed the type to document/literal.
 
 

I have a global class, which has two Methods, and each performs a different out call function,

should each method has a @future annotation?

 

for example,

 

global class PerformOutcall {

 

     @future (callout=true)

       public static void OutCallRun1() {              WS.ServiceSoap dns =

new WS.ServiceSoap();

              dns.Webservice1();

     }

 

     @future (callout=true)

      public static void OutCallRun2() {              WS.ServiceSoap dns =

new WS.ServiceSoap();

              dns.Webservice2();

     }

 

 

}

  • February 11, 2009
  • Like
  • 0

Hi all-

 

I'm curious if anybody can help me out here.  I'm trying to integrate an exact target xml api, and I'm getting a "Bad Request" when making this call.  However, the input string works fine if you post in a browser.  Is there something I'm missing?  The same code works fine for a different call to the exact target api.

 


 

 

public void addSubscriber() {

// add subscriber to list
// Get the XML document from the external server
Http http = new Http();
HttpRequest req = new HttpRequest();

String inputString = 'https://api.dc1.exacttarget.com/integrate.aspx?qf=xml&xml=<exacttarget><authorization><username>myusername</username><password>mypassword</password></authorization><system><system_name>subscriber</system_name><action>add</action><search_type>listid</search_type><search_value>371041</search_value><search_value2></search_value2><values><Email__Address>webmaster@extraspace.com</Email__Address><status>active</status><Full_Name>TESTING 123</Full_Name></values><update>true</update></system></exacttarget>';


req.setEndpoint(inputString);
req.setMethod('GET');


HttpResponse res = http.send(req);

// Log the XML content
System.debug(res.getBody());

// Generate the HTTP response as an XML stream
XmlStreamReader reader = res.getXmlStreamReader();

// Read through the XML
while(reader.hasNext()) {
System.debug('Event Type:' + reader.getEventType());
if (reader.getEventType() == XmlTag.START_ELEMENT) {
System.debug(reader.getLocalName());
}
reader.next();
}

}

 

 

Cheers, 

 

BW