[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] Constructing the SOAP



Don,

I do not see any name/data pairs. The example looks like Java code and
all I see is that it constructs new objects, e.g. "new Address()", and
that it assigns values to the attributes of the objects.

In RPG it would look similar to this:

D booking_t      ds           qualified template
D  fleet                      likeds(fleet_t)
D  locations                  likeds(location_t) dim(100)

D location_t     ds           qualified template
D  LocationType         50a
D  AddressType          50a
D  Address                    likeds(address_t)

D address_t      ds           qualified template
D  Street                     likeds(street_t)
D  Designation                likeds(destination_t)
D  Suburb                     likeds(suburb_t)

D fleet_t        ds           qualified template
D  ID                   10i 0

D street_t       ds           qualified template
D  ID                   10i 0

D destination_t  ds           qualified template
D  ID                   10i 0

D suburb_t       ds           qualified template
D  ID                   10i 0

That might not be 100% accurate but it should give you an idea. Some
fields that show up in the XML are missing and have not obviously been
assigned a value, such as "CustomerName" and "CustomerPhoneNumber".

On the other hand, "Address" do not show up with its attributes in the
XML, because it has been assumed to be NULL. See the "nil" attribute of
address:

   <Address xsi:nil="true" />

From my point of view that example is not consistent and almost useless,
because the values assigned to the request message do not match the XML.

When you create an address object and assign it to the request message,
it cannot be null in the XML:

   booking.Locations[0].Address = new Address()

   versus

   <Address xsi:nil="true" />


Thomas.

Am 03.10.2017 um 08:51 schrieb Don Brown:
> Hello
> 
> I am on V7R2 with current ptf's
> 
> Below I have included the SOAP from the web service server and an
> example provided by the supplier of the web service.
> 
> I'm just a little confused on how to construct the xml for the SOAP body
> based on the example code in RPG.
> 
> The code seems to be creating an array of 2 elements and then named
> pairs (name and data) to the array but not all the elements exist in the
> SOAP xml which is where I am getting lost.  And what the data string
> actually looks like would compltely answer my question.
> 
> I am sure this could be explained better but I hope someone can
> understand what I am trying to say.
> 
> Any reference to Token below is already sorted and working as we use
> other web service methods that require the Token.
> 
> 
> Appreciate any assistance
> 
> // Create booking and set fleet ID
> Booking booking = new Booking();
> booking.Fleet = new Fleet();
> booking.Fleet.ID = 1;
> 
> // Create pick-up location
> booking.Locations = new Location[2];
> booking.Locations[0] = new Location();
> booking.Locations[0].LocationType = LocationType.PickUp;
> booking.Locations[0].AddressType = AddressType.Street;
> booking.Locations[0].Address = new Address();
> booking.Locations[0].Address.Street = new Street();
> booking.Locations[0].Address.Street.ID = 12;
> booking.Locations[0].Address.Designation = new Designation();
> booking.Locations[0].Address.Designation.ID = 14;
> booking.Locations[0].Address.Suburb = new Suburb();
> booking.Locations[0].Address.Suburb.ID = 9;
> booking.Locations[0].TimeMode = TimeMode.NextAvailable;
> 
> // Create drop-off location
> booking.Locations[1] = new Location();
> booking.Locations[1].LocationType = LocationType.DropOff;
> booking.Locations[1].AddressType = AddressType.None;
> 
> BookingWebService.CreateBooking({token}, booking);
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:soap12="http://www.w3.org/2003/05/soap-envelope";>
>   <soap12:Body>
>     <CreateBooking
> xmlns="http://schemas.mt.com.au/dispatch/2.20.0/booking";>
>       <authenticationToken>string</authenticationToken>
>       <booking>
>         <BookingID>long</BookingID>
>         <Fleet ID="int" Name="string" />
>         <Locations>
>           <Location>
>             <Address xsi:nil="true" />
>             <AddressType>None or Street or Suburb or Position or Place
> or Designation</AddressType>
>             <CustomerName>string</CustomerName>
>             <CustomerPhoneNumber>string</CustomerPhoneNumber>
>             <CustomerEmail>string</CustomerEmail>
>             <LocationType>PickUp or DropOff</LocationType>
>             <Notifications xsi:nil="true" />
>             <Pax>int</Pax>
>             <Remark>string</Remark>
>             <Time>dateTime</Time>
>             <TimeMode>None or NextAvailable or SpecificTime</TimeMode>
>             <SendPhoneToDriver>boolean</SendPhoneToDriver>
>             <UsedNavToPickupAddress>boolean</UsedNavToPickupAddress>
>             <EventDetails xsi:nil="true" />
>             <Passengers xsi:nil="true" />
>           </Location>
>           <Location>
>             <Address xsi:nil="true" />
>             <AddressType>None or Street or Suburb or Position or Place
> or Designation</AddressType>
>             <CustomerName>string</CustomerName>
>             <CustomerPhoneNumber>string</CustomerPhoneNumber>
>             <CustomerEmail>string</CustomerEmail>
>             <LocationType>PickUp or DropOff</LocationType>
>             <Notifications xsi:nil="true" />
>             <Pax>int</Pax>
>             <Remark>string</Remark>
>             <Time>dateTime</Time>
>             <TimeMode>None or NextAvailable or SpecificTime</TimeMode>
>             <SendPhoneToDriver>boolean</SendPhoneToDriver>
>             <UsedNavToPickupAddress>boolean</UsedNavToPickupAddress>
>             <EventDetails xsi:nil="true" />
>             <Passengers xsi:nil="true" />
>           </Location>
>         </Locations>
>         <BookingSourceType>int</BookingSourceType>
>       </booking>
>     </CreateBooking>
>   </soap12:Body>
> </soap12:Envelope>
> 
> 
> 
> Thanks
> 
> 
> Don Brown
> 
> 
> 
> 
-- 
_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi