function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Avi646Avi646 

unable to call custom webservice class from java client

partnerConnection = Connector.newConnection(config);
partnerConnection.login(USERNAME, PASSWORD);
System.out.println("SessionId: " + config.getSessionId());	
			
MyWebServiceBindingStub Stub = new WyndhamMyWebServiceBindingStub();
			
MyWebServiceServiceLocator objMyWebServiceLocator=new MyWebServiceServiceLocator();
Stub=(MyWebServiceBindingStub)new MyWebServiceServiceLocator().getMyWebService();
			
SessionHeader_element sh = new SessionHeader_element();
sh.setSessionId(config.getSessionId());

Stub.setHeader(objMyWebServiceLocator.getServiceName().getNamespaceURI(),"SessionHeader",  sh);
Stub.callAction();

 the code for the my java client looks like this but when I am executing the code am always getting No serializer found for class com.sforce.soap.partner.SessionHeader_element in registry org.apache.axis.encoding.TypeMappingDelegate@96cf11

 

Can somebody help me out, where actually m doing wrong.

Best Answer chosen by Admin (Salesforce Developers) 
dkadordkador

I believe you're using the the wrong SessionHeader.  Don't use the one from the partner namespace.  Use the one from your custom wsdl's namespace.

All Answers

dkadordkador

Did you run wsdl2java on the wsdl from your custom webservice?

Avi646Avi646

Yes i ran WSDL2JAVA for creating the classes

dkadordkador

I believe you're using the the wrong SessionHeader.  Don't use the one from the partner namespace.  Use the one from your custom wsdl's namespace.

This was selected as the best answer
Avi646Avi646

i fear that there is no session header in the custom webservice class

dkadordkador

There definitely is.

Avi646Avi646

Sorry but i couldnt find Session header in the class generated by the custom WSDL.

After using wsdl2java 5 major classes were generated.

1) CustomWebserviceBindingStub

2)CustomWebservicePortType

3)CustomWebservicePortTypeProxy

4)CustomWebserviceService

5)CustomWebserviceServiceLocator

 

Where i should be looking for the session header?

dkadordkador

You're saying if you open your wsdl in a text editor and ctrl+f for "session", that nothing comes up?

Avi646Avi646

Thanks for the help. There was problem with setting in eclipse Wsdl2Java. The setting "Generate code for all elements" has to be checked

dkadordkador

Ah, glad you got it worked out.

sankalita chatterjeesankalita chatterjee
Though this thread is very very old, it just saved my day !! Thanks Avi646 for pointing out that setting, I was stuck with namespace class of SessionHeader for so long. Finally changed that setting from Eclipse and now everything is working :)