+ Start a Discussion
soasoa 

How to poulate a request object while invoking external web service

Hello ,
 
I was trying to call a method from the apex class generated from an external wsdl
 
The schema of the request object has a complex type with the following structure :
 
Schema of the party :
- <complexType name="party">
- <sequence>
  <element name="FullName" nillable="true" type="xsd:string" />
  <element name="PartySysKey" nillable="true" type="xsd:string" />
  <element name="Person" nillable="true" type="impl:person" /> 
 
.................
..................
  <element name="Employment" nillable="true" type="impl:employment" />
  <element name="ResidenceCountry" nillable="true" type="xsd:int" />
  <element maxOccurs="unbounded" name="Address" nillable="true" type="impl:Address" />
  <element maxOccurs="unbounded" name="Phone" nillable="true" type="impl:phone" />
  </sequence>
  <attribute name="id" type="xsd:string" />
  </complexType>
 
Schema of the Address
 
- <complexType name="Address">
- <sequence>
  <element name="Line1" nillable="true" type="xsd:string" />
  <element name="Line2" nillable="true" type="xsd:string" />
  <element name="City" nillable="true" type="xsd:string" />
  <element name="Zip" nillable="true" type="xsd:int" />
  </sequence>
  <attribute name="id" type="xsd:string" />
  </complexType>
 
While populating the request object, to populate ID I had written a statement like
request_x.TXLifeRequest.OLifE.Party.Id = 1000073628;
 
Then I am getting the compilation error =
Error: Compile Error: Variable does not exist: Id at line 26 column 5

On further exploration I found that the Generated Apex Client is not does not have the ID field on the structure.
Adding the generated code for your ready reference
 
Code:
    public class party {
        public String FullName;
        public String PartySysKey;
        public flaMericaUsNetCorebaseobjects.person Person;
        public Integer PartyTypeCode;
        public String GovtId;
        public Integer GovtIDStatus;
        public Integer GovtIdType;
        public Integer ResidenceState;
        public Integer ResidenceZip;
        public flaMericaUsNetCorebaseobjects.employment Employment;
        public Integer ResidenceCountry;
        public flaMericaUsNetCorebaseobjects.Address[] Address;
        public flaMericaUsNetCorebaseobjects.phone[] Phone;
< ID is Missing here ... >

 
Also  for populating Zip element in the Address we had written a statement like
   request_x.TXLifeRequest.OLifE.Party.Address.Zip = 60601;
 
Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST:flaMericaUsNetCorebaseobjects.party at line 35 column 5
 
Would you please let us know how we can populate this two fields.
 
Thanks & Regards.
Sanghamitra


Message Edited by soa on 09-11-2008 05:23 AM
SuperfellSuperfell
attributes are not supported by WSDL2Apex.
soasoa
Dear Simon ,
 
Many thanks for your usual prompt response.
 
In our current project I need to integrate with an publicly available external Web Service
which has attibute in its schema. ( as mentioned in my earlier email)
 
Is there any way to integrate with that web service.
 
Regards.
Sanghamitra
SuperfellSuperfell
You would have to use the raw http & xml objects instead of the WSDL based generated wrappers.
soasoa

Dear Simon

Thanks a lot for the work around.

Am I correct to assume in that case we need to hand code to create the client.

In that case is it possible to get a sample in the apex language reference or some where else

for the same.

Regards.

Sanghamitra