• George1313
  • NEWBIE
  • 24 Points
  • Member since 2009

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

I am trying to get a handle on how to get past an error when trying to build a package.  The error is:

 

Package upload error. There are problems that prevent this package from being uploaded.
Average test coverage across all Apex Classes and Triggers is 27%, at least 75% test coverage is required.

 

I am puzzled about the 27% because when I run my packaged Apex Classes (I don't have any Triggers) individually I get 85% coverage.  See below.

 

WSContoller2 - 81%
setInTestMethod - 100%
wwwMyWebService - Can't run a test here.  This is a WSDL generated web service call out.

 

Is the 27% all Classes on my development site?  even if they aren't included in my package?

 

Besides the 3 classes above that I wrote, I show the following two Apex Classes that where on my development account when it was first established.  I think they are used for the "Start Here" tab.  Do they count against my code coverage percentages?
    startHereController
    XMLDom

Message Edited by George1313 on 08-11-2009 07:22 PM

I'm new to SalesForce, Apex, and Visual Pages and am trying to figure out how to call a very simple web service from a Visualforce Page. After spending several days going through tutorials, various samples and reading through these forums I feel I am very close. I've addressed all the error messages during the WSDL generation but still haven't been able to put everything together to get my much anticipated "Hello World".

 

I am working with a the very simple Microsoft Dot Net "Hello World" web service that can be accessed here: http://demo4.leaseteam.com/GeorgeTest/Service.asmx There are no inputs and the expected out put is a simple "Hello World".  This is what I have in place so far:

 

1) My site is configure under Administration Setup / Remote Site Settings

2) After some manual hacking of the WSDL with XML Spy I have WSDL generated and in an Apex Class. See below

 

//Generated by wsdl2apex

public class tempuriOrg {
public class HelloWorld_element {
private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
private String[] field_order_type_info = new String[]{};
}
public class ServiceSoap {
public String endpoint_x = 'http://demo4.leaseteam.com/GeorgeTest/Service.asmx';
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://tempuri.org/', 'tempuriOrg'};
public String HelloWorld() {
tempuriOrg.HelloWorld_element request_x = new tempuriOrg.HelloWorld_element();
tempuriOrg.HelloWorldResponse_element response_x;
Map<String, tempuriOrg.HelloWorldResponse_element> response_map_x = new Map<String, tempuriOrg.HelloWorldResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'http://tempuri.org/HelloWorld',
'http://tempuri.org/',
'HelloWorld',
'http://tempuri.org/',
'HelloWorldResponse',
'tempuriOrg.HelloWorldResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.HelloWorldResult;
}
}
public class HelloWorldResponse_element {
public String HelloWorldResult;
private String[] HelloWorldResult_type_info = new String[]{'HelloWorldResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
private String[] field_order_type_info = new String[]{'HelloWorldResult'};
}
}

 

3) I have another Apex Class written as the "controller". It is thus...

 

 

public class WSContoller

{

String output;
String input = 'detroit';

public void getRecord()

{

tempuriOrg.ServiceSoap stub = new tempuriOrg.ServiceSoap();

output= stub.HelloWorld();
//output= 'Test 2';

}

public String getOutput()

{

return output;
//return 'test me';

}

}

 

 4) My Visualforce Page is this...

 

<apex:page controller="WSContoller" tabStyle="Account">
It will be a nice to get output from the controller
<p>You belong to the {!Output} account.</p>
</apex:page>

 

Drum roll ..... I get the output without the expected "Hello World". My page shows:

 

It will be a nice to get output from the controller

You belong to the account.

 

If you've read this far, thank you and I'd appreciate any help or advise that you could give me.

 

I'm new to SalesForce, Apex, and Visual Pages and am trying to figure out how to call a very simple web service from a Visualforce Page. After spending several days going through tutorials, various samples and reading through these forums I feel I am very close. I've addressed all the error messages during the WSDL generation but still haven't been able to put everything together to get my much anticipated "Hello World".

 

I am working with a the very simple Microsoft Dot Net "Hello World" web service that can be accessed here: http://demo4.leaseteam.com/GeorgeTest/Service.asmx There are no inputs and the expected out put is a simple "Hello World".  This is what I have in place so far:

 

1) My site is configure under Administration Setup / Remote Site Settings

2) After some manual hacking of the WSDL with XML Spy I have WSDL generated and in an Apex Class. See below

 

//Generated by wsdl2apex

public class tempuriOrg {
public class HelloWorld_element {
private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
private String[] field_order_type_info = new String[]{};
}
public class ServiceSoap {
public String endpoint_x = 'http://demo4.leaseteam.com/GeorgeTest/Service.asmx';
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://tempuri.org/', 'tempuriOrg'};
public String HelloWorld() {
tempuriOrg.HelloWorld_element request_x = new tempuriOrg.HelloWorld_element();
tempuriOrg.HelloWorldResponse_element response_x;
Map<String, tempuriOrg.HelloWorldResponse_element> response_map_x = new Map<String, tempuriOrg.HelloWorldResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'http://tempuri.org/HelloWorld',
'http://tempuri.org/',
'HelloWorld',
'http://tempuri.org/',
'HelloWorldResponse',
'tempuriOrg.HelloWorldResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.HelloWorldResult;
}
}
public class HelloWorldResponse_element {
public String HelloWorldResult;
private String[] HelloWorldResult_type_info = new String[]{'HelloWorldResult','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] apex_schema_type_info = new String[]{'http://tempuri.org/','true','false'};
private String[] field_order_type_info = new String[]{'HelloWorldResult'};
}
}

 

3) I have another Apex Class written as the "controller". It is thus...

 

 

public class WSContoller

{

String output;
String input = 'detroit';

public void getRecord()

{

tempuriOrg.ServiceSoap stub = new tempuriOrg.ServiceSoap();

output= stub.HelloWorld();
//output= 'Test 2';

}

public String getOutput()

{

return output;
//return 'test me';

}

}

 

 4) My Visualforce Page is this...

 

<apex:page controller="WSContoller" tabStyle="Account">
It will be a nice to get output from the controller
<p>You belong to the {!Output} account.</p>
</apex:page>

 

Drum roll ..... I get the output without the expected "Hello World". My page shows:

 

It will be a nice to get output from the controller

You belong to the account.

 

If you've read this far, thank you and I'd appreciate any help or advise that you could give me.