You need to sign in to do that
Don't have an account?
DJH
Missing setHeader() method in SforceServiceLocator()
I'm trying to duplicate the sample project, using my company's WSDL. I ran the WSDL document through WSDL2Java to get the appropriate classes.
First problem: _QueryOptions and _SessionHeader were not generated. I worked around this by swiping them from the sample project, since they should be the same for all customers.
Second problem: when I compile, I get the following errors:
AccessSforce1.java:182: cannot resolve symbol
symbol : method setHeader (java.lang.String,java.lang.String,com.sforce.soap.enterprise._SessionHeader)
AccessSforce1.java:469: cannot resolve symbol
symbol : method setHeader (java.lang.String,java.lang.String,com.sforce.soap.enterprise._QueryOptions)
The first error is at this part of my application source code, which is verbatim from the example code:
//Create a new session header object and set the session id to that returned by the login
_SessionHeader sh = new _SessionHeader();
sh.setSessionId(loginResult.getSessionId());
binding.setHeader("SforceService", "SessionHeader", sh);
The second error is also an invocation of binding.setHeader:
_QueryOptions qo = new _QueryOptions();
qo.setBatchSize(new Integer(3));
binding.setHeader("SoapService", "QueryOptions", qo);
It seems from the code that setHeader() is supposed to be a method in SforceServiceLocator, or its superclass org.apache.axis.client.Service. But there's no such method.
I'm running Java 1.4.2 and I have Axis 1.1.
How do I get this to work? Is there an implementation for setHeader() (and presumably getHeader() available)?
DJH
First problem: _QueryOptions and _SessionHeader were not generated. I worked around this by swiping them from the sample project, since they should be the same for all customers.
Second problem: when I compile, I get the following errors:
AccessSforce1.java:182: cannot resolve symbol
symbol : method setHeader (java.lang.String,java.lang.String,com.sforce.soap.enterprise._SessionHeader)
AccessSforce1.java:469: cannot resolve symbol
symbol : method setHeader (java.lang.String,java.lang.String,com.sforce.soap.enterprise._QueryOptions)
The first error is at this part of my application source code, which is verbatim from the example code:
//Create a new session header object and set the session id to that returned by the login
_SessionHeader sh = new _SessionHeader();
sh.setSessionId(loginResult.getSessionId());
binding.setHeader("SforceService", "SessionHeader", sh);
The second error is also an invocation of binding.setHeader:
_QueryOptions qo = new _QueryOptions();
qo.setBatchSize(new Integer(3));
binding.setHeader("SoapService", "QueryOptions", qo);
It seems from the code that setHeader() is supposed to be a method in SforceServiceLocator, or its superclass org.apache.axis.client.Service. But there's no such method.
I'm running Java 1.4.2 and I have Axis 1.1.
How do I get this to work? Is there an implementation for setHeader() (and presumably getHeader() available)?
DJH
Hi DJH,
Try using the command switches shown below:
org.apache.axis.wsdl.WSDL2Java -v -a -T 1.2 enterprise.wsdl
That still leaves me with one last problem: the missing setHeader() method. I understand this is defined in Stub, but it doesn't seem to be in either javax.rmi.CORBA.Stub or javax.xml.rpc.Stub, which are the only two varieties I know about. What am I missing?
DJH
Cheers
Simon
DJH
DJH
Cheers
Simon
Not in my copy of org.apache.axis.client.Stub. It does not contain getHeader or setHeader(). Why not?
DJH
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/client/Stub.java
the revision taged as release 1.1 has setHeader in it, you must have an earlier version. I'd grab Axis 1.1 from the apache site and try again.