• Namrap
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

I need to pull just the 'ObjectID' and all I get is a blank value, what am I doing wrong.   

 

here is the returned XML:

 

<soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/ xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

   <soap:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <AddFolderResponse xmlns="http://AgileWebservices">

         <AddFolderResult>

            <ObjectID>109614</ObjectID>

         </AddFolderResult>

      </AddFolderResponse>

   </soap:Body>

</soap:Envelope>

 

Here is my code:

 

global class docshare  
{  
  
   WebService static string invokeExternalWs(integer numOne, integer numTwo)  
    {  
        HttpRequest req = new HttpRequest();  
        req.setEndpoint('https://xxxxxxx');   // for security I have blanked this out
        req.setMethod('POST');  
        req.setHeader('Content-Type', 'text/xml; charset=utf-8');  
        req.setHeader('SOAPAction', 'http://AgileWebservices/AddFolder'); 
        string b = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agil="http://AgileWebservices"><soapenv:Header/><soapenv:Body><agil:AddFolder><agil:user>lapispw</agil:user><agil:password>lapispw</agil:password><agil:folderName>Mikes fifth test</agil:folderName><agil:objectid>25953</agil:objectid></agil:AddFolder></soapenv:Body></soapenv:Envelope>';  
        req.setBody(b);  
        Http http = new Http();  
        try {  
          //Execute web service call here
          String xObjectID ='';  
          String soapNS = 'http://schemas.xmlsoap.org/soap/envelope/';     
          HTTPResponse res = http.send(req);
          Dom.Document doc = res.getBodyDocument();
          Dom.XMLNode root = doc.getRootElement();

          for(dom.XmlNode node : doc.getRootElement().getChildElements()) {
             xObjectID = node.getName();
             if(node.getName()== 'AddFolderResult') {
                xObjectID = node.getChildElement('ObjectID', soapNS).getText();
             }
          }
         return res.getBody();
       } catch(System.CalloutException e){  
          return 'ERROR:' + e;  
     }         
}  
}

  • April 05, 2012
  • Like
  • 0

I need some help. I can not get salesforce to access an external web service.  I have added the endpoint thru Remote Site Settings and generated the APEX Classes from the wsdl using wsdl2apex.  I have added a button to the opportunity to activate the web service.  When I press the button I get the following error.

 

A problem with the OnClick JavaScript for this button or link was encountered:

 

{faultcode:'soapenv:Client', faultstring:'No operation available for request {http://soap.sforce.com/schemas/package/agilewebservices}AgileWebservices.AddFolder, please check the WSDL for the service.',}

 

What am I missing?  I can access the webservice internally using soapUI 3.6 so I know the service works.

  

Here is the generated Apex Class:

 

//Generated by wsdl2apex

public class agilewebservices {
    public class x_E_S_01843S_ServicesSOAPSOAP11Document_E_S_01843S_Services {
        public String endpoint_x = 'https://websvcs01.test1.embarq.com:443/E/S/01843S/Services';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://AgileWebservices', 'agilewebservices', 'http://AgileWebservices/AbstractTypes', 'agilewebservicesAbstracttypes'};
        public agilewebservices.LLDocument AddFolder(String user_x,String password,String folderName,Integer objectid) {
            agilewebservices.AddFolder_element request_x = new agilewebservices.AddFolder_element();
            agilewebservices.AddFolderResponse_element response_x;
            request_x.user_x = user_x;
            request_x.password = password;
            request_x.folderName = folderName;
            request_x.objectid = objectid;
            Map<String, agilewebservices.AddFolderResponse_element> response_map_x = new Map<String, agilewebservices.AddFolderResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://AgileWebservices/AddFolder',
              'http://AgileWebservices',
              'AddFolder',
              'http://AgileWebservices',
              'AddFolderResponse',
              'agilewebservices.AddFolderResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.AddFolderResult;
        }
    }
    public class LLDocument {
        public String DocumentName;
        public Integer ObjectID;
        private String[] DocumentName_type_info = new String[]{'DocumentName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] ObjectID_type_info = new String[]{'ObjectID','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://AgileWebservices','true','false'};
        private String[] field_order_type_info = new String[]{'DocumentName','ObjectID'};
    }
    public class AddFolderResponse_element {
        public agilewebservices.LLDocument AddFolderResult;
        private String[] AddFolderResult_type_info = new String[]{'AddFolderResult','http://AgileWebservices','LLDocument','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://AgileWebservices','true','false'};
        private String[] field_order_type_info = new String[]{'AddFolderResult'};
    }
    public class AddFolder_element {
        public String user_x;
        public String password;
        public String folderName;
        public Integer objectid;
        private String[] user_x_type_info = new String[]{'user','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] password_type_info = new String[]{'password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] folderName_type_info = new String[]{'folderName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] objectid_type_info = new String[]{'objectid','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://AgileWebservices','true','false'};
        private String[] field_order_type_info = new String[]{'user_x','password','folderName','objectid'};
    }
}

 

Here is the button code:

 

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")}
var myvar = sforce.apex.execute("agilewebservices","AgileWebservices.AddFolder", {user_x:"lapispw",password:"lapispw",folderName:"Mikes Third Test - 00000003",objectid:25953});
window.alert(myvar);

 

  • April 03, 2012
  • Like
  • 0

I need some help. I can not get salesforce to access an external web service.  I have added the endpoint thru Remote Site Settings and generated the APEX Classes from the wsdl using wsdl2apex.  I have added a button to the opportunity to activate the web service.  When I press the button I get the following error.

 

A problem with the OnClick JavaScript for this button or link was encountered:

 

{faultcode:'soapenv:Client', faultstring:'No operation available for request {http://soap.sforce.com/schemas/package/agilewebservices}AgileWebservices.AddFolder, please check the WSDL for the service.',}

 

What am I missing?  I can access the webservice internally using soapUI 3.6 so I know the service works.

  

Here is the generated Apex Class:

 

//Generated by wsdl2apex

public class agilewebservices {
    public class x_E_S_01843S_ServicesSOAPSOAP11Document_E_S_01843S_Services {
        public String endpoint_x = 'https://websvcs01.test1.embarq.com:443/E/S/01843S/Services';
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://AgileWebservices', 'agilewebservices', 'http://AgileWebservices/AbstractTypes', 'agilewebservicesAbstracttypes'};
        public agilewebservices.LLDocument AddFolder(String user_x,String password,String folderName,Integer objectid) {
            agilewebservices.AddFolder_element request_x = new agilewebservices.AddFolder_element();
            agilewebservices.AddFolderResponse_element response_x;
            request_x.user_x = user_x;
            request_x.password = password;
            request_x.folderName = folderName;
            request_x.objectid = objectid;
            Map<String, agilewebservices.AddFolderResponse_element> response_map_x = new Map<String, agilewebservices.AddFolderResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://AgileWebservices/AddFolder',
              'http://AgileWebservices',
              'AddFolder',
              'http://AgileWebservices',
              'AddFolderResponse',
              'agilewebservices.AddFolderResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.AddFolderResult;
        }
    }
    public class LLDocument {
        public String DocumentName;
        public Integer ObjectID;
        private String[] DocumentName_type_info = new String[]{'DocumentName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] ObjectID_type_info = new String[]{'ObjectID','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://AgileWebservices','true','false'};
        private String[] field_order_type_info = new String[]{'DocumentName','ObjectID'};
    }
    public class AddFolderResponse_element {
        public agilewebservices.LLDocument AddFolderResult;
        private String[] AddFolderResult_type_info = new String[]{'AddFolderResult','http://AgileWebservices','LLDocument','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://AgileWebservices','true','false'};
        private String[] field_order_type_info = new String[]{'AddFolderResult'};
    }
    public class AddFolder_element {
        public String user_x;
        public String password;
        public String folderName;
        public Integer objectid;
        private String[] user_x_type_info = new String[]{'user','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] password_type_info = new String[]{'password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] folderName_type_info = new String[]{'folderName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] objectid_type_info = new String[]{'objectid','http://www.w3.org/2001/XMLSchema','int','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://AgileWebservices','true','false'};
        private String[] field_order_type_info = new String[]{'user_x','password','folderName','objectid'};
    }
}

 

Here is the button code:

 

{!REQUIRESCRIPT("/soap/ajax/24.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/24.0/apex.js")}
var myvar = sforce.apex.execute("agilewebservices","AgileWebservices.AddFolder", {user_x:"lapispw",password:"lapispw",folderName:"Mikes Third Test - 00000003",objectid:25953});
window.alert(myvar);

 

  • April 03, 2012
  • Like
  • 0