• silverbullet
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I am trying to mash-up info returned by "zack company" web service (strikeiron) by converting thier wsdl to apex code in salesforce.
The following s-control isnt working for me - can you please let me know the correction required?
 
<script type="text/javascript" src="/js/functions.js"></script>
<script src="/soap/ajax/10.0/connection.js"></script>
<script src="/soap/ajax/10.0/apex.js"></script>
<script src="http://ws.strikeiron.com/ZacksCompany3?WSDL"></script><script>
function stockQuote() {
var result = sforce.apex.execute("strikeIronZackComp ","getCompProf",{arg:"jns"});
document.getElementById('userNameArea').innerHTML = 'details: '+result;
}
</script>

<body onload=stockQuote()>
<div id=userNameArea></div>

</body>
I am using the below apex code for the s-control
 
global class strikeIronZackComp {

    WebService static string getCompProf(string ticker){
        string result;
        wwwStrikeironCom3.ZacksCompanySoap zcomp = new wwwStrikeironCom3.ZacksCompanySoap();

        // Set up the license header
        zcomp.LicenseInfo = new wsStrikeironCom3.LicenseInfo();
        zcomp.LicenseInfo.UnregisteredUser = new wsStrikeironCom3.UnregisteredUser();
        zcomp.LicenseInfo.UnregisteredUser.EmailAddress = 'sippon77@gmail.com';
        
        // Make the Web service call
        wwwStrikeironCom3.ZacksCompanyOutput compprof = zcomp.GetCompanyProfile('jns');

        result  = compprof.ServiceResult.Ticker;
        //result = comprof.Ticker
        //return result;
        return compprof.ServiceResult.Ticker;
        }
        
    static testMethod void testHelloWorld() {
            System.assertEquals('Hello to you!', getCompProf('jns'));
    }
}
Hi ,

I am trying to call an external web service from Visual force. I have taken a WSDL from http://strikeiron.com/ .This Web service provides DNS lookup information from a server name. I parsed the WSDL to the apex class and  trying to call the request method in the Converted class from visual force. Visual force page Contains a button .On click ,it should display the dns name of Server passing('www.google.com') But whenever I am clicking on it .Getting an error:-"System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: No user identifier provided faultcode=soap:Client faultactor="



//Generated by wsdl2apex

public class tempuriOrg {
    public class ArrayOfString {
        public String[] string_x;
        private String[] string_x_type_info = new String[]{'string','http://www.w3.org/2001/XMLSchema','string','0','-1','true'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
        private String[] field_order_type_info = new String[]{'string_x'};
    }
    public class DNSInfo {
        public String HostName;
        public tempuriOrg.ArrayOfString Aliases;
        public tempuriOrg.ArrayOfString AddressList;
        private String[] HostName_type_info = new String[]{'HostName','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] Aliases_type_info = new String[]{'Aliases','http://tempuri.org/','ArrayOfString','0','1','false'};
        private String[] AddressList_type_info = new String[]{'AddressList','http://tempuri.org/','ArrayOfString','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
        private String[] field_order_type_info = new String[]{'HostName','Aliases','AddressList'};
    }
    public class DNSLookupResponse_element {
        public tempuriOrg.DNSInfo DNSLookupResult;
        private String[] DNSLookupResult_type_info = new String[]{'DNSLookupResult','http://tempuri.org/','DNSInfo','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
        private String[] field_order_type_info = new String[]{'DNSLookupResult'};
    }
    public class DNSSoap {
        public String endpoint_x = 'http://ws.strikeiron.com/relauto/iplookup/DNS';
        public wsStrikeironCom.SubscriptionInfo SubscriptionInfo;
        public wsStrikeironCom.LicenseInfo LicenseInfo;
        private String SubscriptionInfo_hns = 'SubscriptionInfo=http://ws.strikeiron.com';
        private String LicenseInfo_hns = 'LicenseInfo=http://ws.strikeiron.com';
        private String[] ns_map_type_info = new String[]{'http://ws.strikeiron.com', 'wsStrikeironCom', 'http://tempuri.org/', 'tempuriOrg'};
        public tempuriOrg.DNSInfo DNSLookup(String server) {
            tempuriOrg.DNSLookup_element request_x = new tempuriOrg.DNSLookup_element();
            tempuriOrg.DNSLookupResponse_element response_x;
            request_x.server = server;
            Map<String, tempuriOrg.DNSLookupResponse_element> response_map_x = new Map<String, tempuriOrg.DNSLookupResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://tempuri.org/DNSLookup',
              'http://tempuri.org/',
              'DNSLookup',
              'http://tempuri.org/',
              'DNSLookupResponse',
              'tempuriOrg.DNSLookupResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.DNSLookupResult;
        }
        public void GetRemainingHits() {
            wsStrikeironCom.GetRemainingHits_element request_x = new wsStrikeironCom.GetRemainingHits_element();
            wsStrikeironCom.GetRemainingHitsResponse_element response_x;
            Map<String, wsStrikeironCom.GetRemainingHitsResponse_element> response_map_x = new Map<String, wsStrikeironCom.GetRemainingHitsResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              'http://ws.strikeiron.com/relauto/iplookup/DNS/GetRemainingHits',
              'http://ws.strikeiron.com',
              'GetRemainingHits',
              'http://ws.strikeiron.com',
              'GetRemainingHitsResponse',
              'wsStrikeironCom.GetRemainingHitsResponse_element'}
            );
            response_x = response_map_x.get('response_x');
        }
    }
    public class DNSLookup_element {
        public String server;
        private String[] server_type_info = new String[]{'server','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true'};
        private String[] field_order_type_info = new String[]{'server'};
    }
}

It generated one more class wsStrikeironCom inside that I have given the userid and password inside a method called Which is


public class RegisteredUser {
        public String UserID='rachana.raveendran@gmail.com';
        public String Password='*******';
        private String[] UserID_type_info = new String[]{UserID,'http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] Password_type_info = new String[]{Password,'http://www.w3.org/2001/XMLSchema','string','0','1','true'};
        private String[] apex_schema_type_info = new String[]{'http://ws.strikeiron.com','true'};
        private String[] field_order_type_info = new String[]{UserID,Password};
    }




Here is my visual force code

public class Temperature
{
tempuriOrg.DNSInfo output;
public void recordReplicator()
{
tempuriOrg.DNSSoap stub = new tempuriOrg.DNSSoap(); String nserver='www.google.com'; System.debug('Server Ips'); output= stub.DNSLookup(nserver); System.Debug('output'+output); } public tempuriOrg.DNSInfo getOutput() { return output; } }

Remote site is created for http://ws.strikeiron.com

Please help me to solve this

Thanks