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
bs2bs2 

sObject definition missing in Apex Class WSDL

I have an apex class which has a custom method taking sobject[] as argument as follows
 
webservice static insertCustomObject(sObject[] customObjects)
{
  // type of insertObjects is my custom objects in salesforce
   insert customObjects;
 
}
 
When wsdl is generated, it does not include definition of sObject and hence the java stub code generation fails. Can anyone let me know what am i missing here? There are many custom objects and hence I want to have only one webservice method which can take sObject and the caller can pass in any custom object type.
 
Thx
SuperfellSuperfell
I can't answer the question, but will ask why you're rebuilding the standard API in apex? (the create method in the enterprise or partner API does exactly what you have).
bs2bs2
I was able to get SObject definition in generated WSDL. Reason I am defining similar method as salesForce standard API is because I have a conditon where by I need to invoke the insert with either all or non failure behavior or partial success behavior. I control this through caller sending a boolean true or false and based on that I invoke insert with either true or false parameter in batch insert.
 
But I am now having another problem. When i pass in the custom defined object in SOBject[ ] for insert, I get an exception. the stack trace is not clear. See below.
 

AxisFault

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server

faultSubcode:

faultString: Class.MyWebService.createObject: line 8, column 8

faultActor:

faultNode:

faultDetail:

{http://xml.apache.org/axis/}stackTrace:Class.MyWebService.createObject: line 8, column 8

at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)

at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)

at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)

at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

at javax.xml.parsers.SAXParser.parse(Unknown Source)

at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)

at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)

at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)

at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at com.sforce.soap.schemas._class.MyWebService.MyWebServiceBindingStub.createObject(MyWebServiceBindingStub.java:1842)

at com.myclient.MyParser.toXML(MyParser.java:332)

at com.myclient.MyParser.run(MyParser.java:168)

at java.util.TimerThread.mainLoop(Unknown Source)

at java.util.TimerThread.run(Unknown Source)