• dknoern
  • NEWBIE
  • 0 Points
  • Member since 2010

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

Hi,

 

I am stuck trying to integrate to an external web service using an Apex callout.

 

I have generated the classes using WSDL2Apex and am trapping the SOAP callout in Eclipse.  When I run it from Salesforce (via execute anonymous in Eclipse) it gives me this SOAP message (which returns an error along the line of 'Expression produces unexpected value: null.' from the web service provider):

 

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Header /> <env:Body> <m:dynamicQandA xmlns:m="http://qddynamicqandaservice/"> <arg0> <PolicyData policyExpiryDate="?" noClaimsDiscountStatus="?" lastRenewalDate="?" premiumPaidTodateStatus="?" levelOfCoverCode="?" nextRenewalDate="?" productCode="?" policyEffectiveDate="?" policyType="?" policyInceptionDate="?" terminationCode="?" reinsurerIndicator="?" /> <ManagementInformation executeFinish="?" lastRuleID="?" message="?" executeTime="?" executeStart="?" /> <Outcome nextQuestion="?" ruleState="?" outcomeMessage="?" rulesComplete="true" outcomeName="?" /> <Question> <QuestionName>Service Request Type</QuestionName> <AnswerDataType>String</AnswerDataType> <AnswerValue>Insurance Claim</AnswerValue> </Question> </arg0> </m:dynamicQandA> </env:Body> </env:Envelope>

 

HOWEVER when I run it from SOAP UI (a non-Salesforce tool that generates Webservice calls outs from WSDL) I get the following SOAP message (which works fine, no error msg):

 

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qdd="http://qddynamicqandaservice/" xmlns:ccl="http://www.cdecisions.com/cclaimsrulesservice"> <soapenv:Header/> <soapenv:Body> <qdd:dynamicQandA> <!--Optional:--> <arg0> <ccl:PolicyData productCode="?" lastRenewalDate="?" levelOfCoverCode="?" nextRenewalDate="?" noClaimsDiscountStatus="?" policyEffectiveDate="?" policyExpiryDate="?" policyInceptionDate="?" policyType="?" premiumPaidTodateStatus="?" reinsurerIndicator="?" terminationCode="?"/> <ccl:ManagementInformation lastRuleID="?" executeTime="?" message="?" executeStart="?" executeFinish="?"/> <Outcome outcomeName="?" outcomeMessage="?" rulesComplete="?" ruleState="?" nextQuestion="?">?</Outcome> <!--Zero or more repetitions:--> <ccl:Question> <QuestionName>Service Request Type</QuestionName> <AnswerDataType>String</AnswerDataType> <AnswerValue>Insurance Claim</AnswerValue> </ccl:Question> </arg0> </qdd:dynamicQandA> </soapenv:Body> </soapenv:Envelope>

 

So it appears that Salesforce is not forming the SOAP message well - specifically it appears to be dropping the second namespace (= http://www.cdecisions.com/cclaimsrulesservice).

 

I have tried hacking the generated classes from WSDL2Apex without much luck (although to be honest it has been mainly trial and error!).

  

My issue seems very similar to that discribed here: http://community.salesforce.com/sforce/board/message?board.id=apex&message.id=4679

 

However the answer to that one was that it is a SF bug that is now allegedly fixed??....  So I am at a loss!

 

Can anyone help?  Any advice on how I might fix (is it possible to fix by tweaking the generated WSDL2Apex Classes?)

 

Thanks in advance,

 

Demi 

Message Edited by Demint on 12-16-2009 02:13 AM
  • December 15, 2009
  • Like
  • 0
Hello,

I have a very tricky problem with a web service call I'm doing to an external server.  When I generate the WSDL and do a callout, I get this SOAP request that I trap in the System Log with the debug level set to "Callout":

Code:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <env:Header />
 <env:Body>
  <doUserPointTransactions xmlns="http://webservice.razorpoints.ilr.com">
   <adminUsername>my.name@domain.com</adminUsername>
   <adminPassword>mypassword</adminPassword>
   <wsPointUploads>
    <WsPointUpload>
     <amount>111</amount>
     <description>aaaaaaaaaaaaa</description>
     <programAccountPK>1</programAccountPK>
     <userPK>bbb</userPK>
    </WsPointUpload>
   </wsPointUploads>
  </doUserPointTransactions>
 </env:Body>
</env:Envelope>

However, this returns a SoapFault because the receiving side says that WsPointUpload is empty, which it clearly is not.  When I generate the same web service call in Eclipse with the same WSDL, I get this:

Code:
<soapenv:Envelope xmlns:q0="http://webservice.razorpoints.ilr.com" 
 xmlns:q1="http://webservice.model.razorpoints.ilr.com"
 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Header></soapenv:Header>
 <soapenv:Body>
  <q0:doUserPointTransactions>
   <q0:adminUsername>my.name@domain.com</q0:adminUsername>
   <q0:adminPassword>mypassword</q0:adminPassword>
   <q0:wsPointUploads>
    <q1:WsPointUpload>
     <q1:amount>111</q1:amount>
     <q1:description>aaaaaaaaaaaaa</q1:description>
     <q1:programAccountPK>1</q1:programAccountPK>
     <q1:userPK>bbb</q1:userPK>
    </q1:WsPointUpload>
   </q0:wsPointUploads>
  </q0:doUserPointTransactions>
 </soapenv:Body>
</soapenv:Envelope>

Note that in this request, there are two namespaces, http://webservice.razorpoints.ilr.com and http://webservice.model.razorpoints.ilr.com.  In the first WS call (the one generated by Salesforce) there is only one namespace, http://webservice.razorpoints.ilr.com, and the WsPointUpload element is not part of this namespace.

If I make a SOAP request in Eclipse using the Salesforce request (the first one above) and manually add 'xmlns="http://webservice.model.razorpoints.ilr.com"' to the <WsPointUpload> element, the web service call works.  Is there any way I can force this second namespace to appear in Salesforce or is this just a Saleforce bug?


Message Edited by ckemp on 05-16-2008 10:14 AM
  • May 16, 2008
  • Like
  • 0