XDTO - WebReference - Array

1C:Enterprise platform integration capabilities and techniques

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

Hello everybody!
Sorry for my English. I hope I will be understood.
I've got such a problem to solve...
I need to make ArrayOfParcel according to http://api.inpost.opennet.pl/api.asmx?WSDL
I've got parameter

Code
GetAvailableServicesRequest.Parcels = ArrayOfParcel;


When I give this parameter in this way below, I get an answer "Wrong XDTO type":
Code
ArrayOfParcel = New ValueList();
ArrayOfParcel.Add(Parcel.Type="Package",Parcel.Weight=1);
ArrayOfParcel.Add(Parcel.Type="Package",Parcel.Weight=3);


I tried also, but result the same as above, i.e "Wrong XDTO type":
Code
ArrayOfParcel = new ValueTable();
ArrayOfParcel.Columns.Add("Weight");
ArrayOfParcel.Columns.Add("Type");

Parcel = ArrayOfParcel.Add(
Parcel.Type = "Package",
Parcel.Weight = 1;
);

Parcel2 = ArrayOfParcel.Add(
Parcel.Type = "Package";
Parcel.Weight = 1;
);


I need to write it in proper way but I don't have any idea how to do it. Could you help me? Any clues? Thank you in advance for every single answer.
Kris

 
#2
People who like this:0Yes/0No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Kris!

First, please create the XDTO package in Common/XDTO packages. You can also right-click on XDTO packages and select Import XML schema to import the XSL.

Then, please, try the following syntax to create an XDTO object of the created type:

Code
ArrayOfParcel = XDTOFactory.Create(XDTOFactory.Type("http://SubstituteXDTOPackageURL", "SubstituteArrayOfParcelXDTOType"));

While SubstituteCondition Do
  Parcel = XDTOFactory.Create(XDTOFactory.Type("http://SubstituteXDTOPackageURL", "SubstituteParcelXDTOType"));
  Parcel.Weight = WeightValue;
  Parcel.Type = TypeValue;
  ArrayOfParcel.Add(Parcel);
EndDo;

 
#3
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

Hi everyone.

WSReference already contains XDTO package, so you don't need to create it manually.

Code
WSProxy = WSReferences.OpenNetPL.CreateWSProxy("http://tempuri.org/", "ServiceObject", "ServiceObjectSoap");

OpenNetPL_XDTO = WSProxy.XDTOFactory;

ArrayOfParcel = OpenNetPL_XDTO.Create(OpenNetPL_XDTO.Type("http://tempuri.org/", "ArrayOfParcel"));

Parcel = OpenNetPL_XDTO.Create(OpenNetPL_XDTO.Type("http://tempuri.org/", "Parcel"));
Parcel.Type = OpenNetPL_XDTO.Create(OpenNetPL_XDTO.Type("http://tempuri.org/", "ParcelType"), "Envelope");
Parcel.Weight = 0.2;
ArrayOfParcel.Parcel.Add(Parcel);

Parcel = OpenNetPL_XDTO.Create(OpenNetPL_XDTO.Type("http://tempuri.org/", "Parcel"));
Parcel.Type = OpenNetPL_XDTO.Create(OpenNetPL_XDTO.Type("http://tempuri.org/", "ParcelType"), "Palette");
Parcel.Weight = 100;
ArrayOfParcel.Parcel.Add(Parcel);

 
#4
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 18, 2012
Company:

Hello,
Two answers above helped me solve the problem. But they differ a little.
This part of code makes error:

Code
ArrayOfParcel.Add(Parcel);

This part of code works fine:
Code
ArrayOfParcel.Parcel.Add(Parcel);

Thank you Timofei and Alexei for your help. Your answers were very very useful.
Kris

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.