• nicolas.diogo1.3953155885519846E12
  • NEWBIE
  • 0 Points
  • Member since 2014

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

i have to get a Java application to interface with a Web-Service (WS) that is avaiable via SalesForce (SF).

my app has to have its details loaded from property files so that we can test it in different environments before it can be deployed into production.

for that reason, i have to use different URLs, username and password when calling the WS.

with that in mind i have coubled together the code below that i have copied from another developer's blog :
http://kperisetla.blogspot.co.uk/2011/09/creating-custom-apex-web-service-in.html

it should have worked but it does not.
i can collect the correct loginResult and i try setting the URL to the one given by SF.
but it keeps giving me errors as if this object is not available/exist.

certainly, as a new SF user i am missing something unbelieably obvious.

could one of you experts assist me in solving this puzzle?

many thanks,




[error]

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: No operation available for request {http://soap.sforce.com/schemas/class/BananaWs}processInfoXML
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:No operation available for request {http://soap.sforce.com/schemas/class/BananaWs}processInfoXML
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
...

[/error]





[code]


String rsFileProcess = new String();
String xmlFile2Process = "<root><data>some long string goes here</data></root>";

String varContext_username = "app.use@sf.bananas.org.int";
String varContext_password = "Jggbnfkkr88jmkdmXxymJUhP9IeG7yvDlLYXr1jvG";
String varContext_loginUri = "https://test.salesforce.com/";

System.out.println(
"\n\n\tLOGIN DETAILS FOR WS"
+"\n\tuser:\t" + varContext_username
+"\n\tpwd:\t" + varContext_password
);


//Get a stub for calling partner WSDL's login method in order to get SessionID
SoapBindingStub bind = (SoapBindingStub)new SforceServiceLocator().getSoap();

LoginResult lr=bind.login(
varContext_username,
varContext_password
);

//Create a sessionHeader object and set its sessioId property to sessionId
//received in loginResult object                       
SessionHeader sh=new SessionHeader();
sh.setSessionId(lr.getSessionId());

//Create a service locator object for your custom web service
BananaWsServiceLocator locator=new BananaWsServiceLocator();

//Get URL for your custom web service
URL url=new URL(lr.getServerUrl());

//Create a stub for your custom web service with URL for your service and locator as parameters
BananaWsBindingStub stub=new BananaWsBindingStub(url, locator);

//Set the header property of stub with name "SessionHeader" and value as sh-sessionHeader
//object created above
stub.setHeader(locator.getBananaWsAddress(), "SessionHeader", sh);

//now make call to custom service-in
rsFileProcess = stub
.processInfoXML(xmlFile2Process);

System.out.println(

"the file processing returned :: " + rsFileProcess

);


[/code]