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
brad4dbrad4d 

Namespace references incorrect and unmanageable in the generated apex client to a webservice.

    I am using the following wsdl:
Code:
  <—xml version="1.0" encoding="UTF-8" –> 
- <!--  Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.2-b05-RC1. 
  --> 
- <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:specific_calculator-services-kronos-com:specific_calculator" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:specific_calculator-services-kronos-com:specific_calculator" name="SpecificCalculatorService">
- <types>
- <xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:specific_calculator-services-kronos-com:specific_calculator" elementFormDefault="unqualified" attributeFormDefault="unqualified">
- <!--  a name value pair used to add custom attributes to punches, pay code edits, scheduled_shifts, and others. These values assist the rules to make their decisions.
  --> 
- <xs:complexType name="TagType">
- <xs:sequence>
- <!--  categorization for tags. e.g. pay_category, pay_code, cost_center, exception
  --> 
  <xs:element name="name" type="xs:string" /> 
- <!--  tag value. e.g. regular, break, lunch, deli, late_in, very_late_out
  --> 
  <xs:element name="value" type="xs:string" /> 
  </xs:sequence>
  </xs:complexType>
- <!--  A quantity and units. (aka value). This typically denotes the duration for a block of time. Also the quantity for a total
  --> 
- <xs:complexType name="QuantityType">
- <xs:sequence>
- <!--  numerical value
  --> 
  <xs:element name="amount" type="xs:double" /> 
- <!--  change back to unitsType
  --> 
  <xs:element name="units" type="xs:string" minOccurs="0" maxOccurs="1" /> 
  </xs:sequence>
  </xs:complexType>
- <!--  
The Engine assigns values denoting quantities of time. e.g. Regular=5 hrs, Late=5 times to a pay category.
These are typically the durations for a particular scheduled block of time or period block of time.

  --> 
- <xs:complexType name="TotalType">
- <xs:sequence>
- <!--  Effective date. change back to date
  --> 
  <xs:element name="effective_date" type="xs:dateTime" /> 
- <!--  actual, scheduled, or projected. change back to total_type
  --> 
  <xs:element name="total_type" type="xs:string" /> 
- <!--  type of pay for employee
  --> 
  <xs:element name="pay_code" type="xs:string" /> 
- <!--  total value. (has amount and units)
  --> 
  <xs:element name="quantity" type="tns:QuantityType" /> 
  </xs:sequence>
  </xs:complexType>
- <!--  
punches in the clock or modified by the manager

  --> 
- <xs:complexType name="PunchType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
  <xs:element name="effective_date" type="xs:dateTime" /> 
- <!--  change back to punch_direction
  --> 
  <xs:element name="punch_direction" type="xs:string" /> 
  </xs:sequence>
  </xs:complexType>
- <!--  
Work that was actually done.

  --> 
- <xs:complexType name="PayCodeEditType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
  <xs:element name="pay_code_category" type="xs:string" minOccurs="0" maxOccurs="1" /> 
  <xs:element name="pay_code" type="xs:string" minOccurs="0" maxOccurs="1" /> 
- <!--  start time. typically populated
  --> 
  <xs:element name="start_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  end time. typically populated or duration
  --> 
  <xs:element name="end_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  length of this pay_code_edit
  --> 
  <xs:element name="duration" type="tns:QuantityType" minOccurs="0" maxOccurs="1" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="BreaksType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
  <xs:element name="pay_code" type="xs:string" minOccurs="0" maxOccurs="1" /> 
- <!--  start time. typically populated
  --> 
  <xs:element name="start_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  end time. typically populated or duration
  --> 
  <xs:element name="end_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  length of this shift
  --> 
  <xs:element name="duration" type="tns:QuantityType" minOccurs="0" maxOccurs="1" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="ExceptionType">
- <xs:sequence>
  <xs:element name="rule_id" type="xs:string" /> 
- <!--  id into resource bundle
  --> 
  <xs:element name="resource_name" type="xs:string" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="ScheduledShiftType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" minOccurs="0" maxOccurs="1" /> 
  <xs:element name="pay_code_category" type="xs:string" minOccurs="0" maxOccurs="1" /> 
  <xs:element name="pay_code" type="xs:string" minOccurs="0" maxOccurs="1" /> 
- <!--  start time. typically populated
  --> 
  <xs:element name="start_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  end time. typically populated or duration
  --> 
  <xs:element name="end_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  length of this shift.
  --> 
  <xs:element name="duration" type="tns:QuantityType" minOccurs="0" maxOccurs="1" /> 
- <!--  breaks during this shift
  --> 
  <xs:element name="breaks" type="tns:BreaksType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="ComputedPunchType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
- <!--  exceptions on this punch
  --> 
  <xs:element name="exceptions" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="ComputedPayCodeEditType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
- <!--  exceptions on this pay_code_edit
  --> 
  <xs:element name="exceptions" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="ComputedBreakType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
  <xs:element name="pay_code" type="xs:string" minOccurs="0" maxOccurs="1" /> 
- <!--  computed start time. populated if break taken
  --> 
  <xs:element name="start_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  computed end time. populated if taken (no duration)
  --> 
  <xs:element name="end_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  punch that starts this break
  --> 
  <xs:element name="start_punch" type="tns:ComputedPunchType" minOccurs="0" maxOccurs="1" /> 
- <!--  punch that ends this break
  --> 
  <xs:element name="end_punch" type="tns:ComputedPunchType" minOccurs="0" maxOccurs="1" /> 
- <!--  exceptions on this break.
  --> 
  <xs:element name="exceptions" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" /> 
- <!--  
The Engine assigns values denoting quantities of time. e.g. Regular=5 hrs, Late=5 times to a pay category.
These are typically the durations for a particular scheduled block of time or period block of time.

  --> 
  <xs:element name="totals" type="tns:TotalType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
- <!--   The schedule blocks of time that are populated with exceptions, flags (containing pay categories), actuals, and all sorts of entries.
Possibly contains newly created blocks of time that are not scheduled.

  --> 
- <xs:complexType name="ComputedShiftType">
- <xs:sequence>
  <xs:element name="id" type="xs:string" /> 
  <xs:element name="pay_code_category" type="xs:string" minOccurs="0" maxOccurs="1" /> 
  <xs:element name="pay_code" type="xs:string" minOccurs="0" maxOccurs="1" /> 
- <!--  date to assign this shift. this used day divide. change back to date
  --> 
  <xs:element name="effective_date" type="xs:dateTime" /> 
- <!--  computed start time. typically populated
  --> 
  <xs:element name="start_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  computed end time. typically populated or duration
  --> 
  <xs:element name="end_date" type="xs:dateTime" minOccurs="0" maxOccurs="1" /> 
- <!--  computed length of this shift. populated for some pay code edits.
  --> 
  <xs:element name="duration" type="tns:QuantityType" minOccurs="0" maxOccurs="1" /> 
- <!--  punch that starts this shift
  --> 
  <xs:element name="start_punch" type="tns:ComputedPunchType" minOccurs="0" maxOccurs="1" /> 
- <!--  punch that ends this shift
  --> 
  <xs:element name="end_punch" type="tns:ComputedPunchType" minOccurs="0" maxOccurs="1" /> 
- <!--  paycode edit id that was used to create this shift
  --> 
  <xs:element name="pay_code_edit" type="tns:ComputedPayCodeEditType" minOccurs="0" maxOccurs="1" /> 
- <!--  exceptions on this shift. (all exceptions˜ summary™)
  --> 
  <xs:element name="exceptions" type="tns:ExceptionType" minOccurs="0" maxOccurs="unbounded" /> 
- <!--  breaks during this shift
  --> 
  <xs:element name="computed_breaks" type="tns:ComputedBreakType" minOccurs="0" maxOccurs="unbounded" /> 
- <!--  
The Engine assigns values denoting quantities of time. e.g. Regular=5 hrs, Late=5 times to a pay category.
These are typically the durations for a particular scheduled block of time or period block of time.

  --> 
  <xs:element name="totals" type="tns:TotalType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
- <!--  
units used for Block of Time amount.
'COUNT' denotes a units of quantity rather than units of time.

  --> 
- <xs:simpleType name="UnitsTypeEnum">
- <xs:restriction base="xs:string">
  <xs:enumeration value="SECONDS" /> 
  <xs:enumeration value="MINUTES" /> 
  <xs:enumeration value="HOURS" /> 
  <xs:enumeration value="DAYS" /> 
  <xs:enumeration value="WEEKS" /> 
  <xs:enumeration value="MONTHS" /> 
  <xs:enumeration value="QUARTERS" /> 
  <xs:enumeration value="YEARS" /> 
  <xs:enumeration value="COUNT" /> 
  </xs:restriction>
  </xs:simpleType>
- <xs:simpleType name="TotalTypeEnum">
- <xs:restriction base="xs:string">
  <xs:enumeration value="ACTUAL" /> 
  <xs:enumeration value="SCHEDULED" /> 
  <xs:enumeration value="PROJECTED" /> 
  </xs:restriction>
  </xs:simpleType>
- <xs:simpleType name="PunchDirectionEnum">
- <xs:restriction base="xs:string">
  <xs:enumeration value="IN" /> 
  <xs:enumeration value="OUT" /> 
  </xs:restriction>
  </xs:simpleType>
- <!--  method request, responses 
  --> 
- <xs:element name="CalculateRequest">
- <xs:complexType>
- <xs:sequence>
- <!--  start of period window. change to date?
  --> 
  <xs:element name="start_date" type="xs:dateTime" /> 
- <!--  end of period window. change to date?
  --> 
  <xs:element name="end_date" type="xs:dateTime" /> 
- <!--  current point in window
  --> 
  <xs:element name="now" type="xs:dateTime" /> 
- <!--  
punches in the clock or modified by the manager

  --> 
  <xs:element name="PunchType" type="tns:PunchType" minOccurs="0" maxOccurs="unbounded" /> 
- <!--  
Work that was actually done.

  --> 
  <xs:element name="pay_code_edits" type="tns:PayCodeEditType" minOccurs="0" maxOccurs="unbounded" /> 
  <xs:element name="scheduled_shifts" type="tns:ScheduledShiftType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <xs:element name="CalculateResponse">
- <xs:complexType>
- <xs:sequence>
- <!--   The schedule blocks of time that are populated with exceptions, flags (containing pay categories), actuals, and all sorts of entries.
Possibly contains newly created blocks of time that are not scheduled.

  --> 
  <xs:element name="computed_shifts" type="tns:ComputedShiftType" minOccurs="0" maxOccurs="unbounded" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
- <!--  faults 
  --> 
- <xs:element name="BadInputFault">
- <xs:complexType>
- <xs:sequence>
  <xs:element name="code" type="xs:string" /> 
  <xs:element name="message" type="xs:string" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:schema>
  </types>
- <!--  messages 
  --> 
- <message name="CalculateRequest">
  <part name="parameters" element="tns:CalculateRequest" /> 
  </message>
- <message name="CalculateResponse">
  <part name="parameters" element="tns:CalculateResponse" /> 
  </message>
- <message name="BadInputFault">
  <part name="fault" element="tns:BadInputFault" /> 
  </message>
- <!--  port 
  --> 
- <portType name="SpecificCalculatorPortType">
- <operation name="calculate">
  <input message="tns:CalculateRequest" /> 
  <output message="tns:CalculateResponse" /> 
  <fault name="BadInputFault" message="tns:BadInputFault" /> 
  </operation>
  </portType>
- <!--  binding 
  --> 
- <binding name="SpecificCalculatorBinding" type="tns:SpecificCalculatorPortType">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <operation name="calculate">
  <soap:operation soapAction="/calculate" style="document" /> 
- <input>
  <soap:body use="literal" /> 
  </input>
- <output>
  <soap:body use="literal" /> 
  </output>
- <fault name="BadInputFault">
  <soap:fault name="BadInputFault" use="literal" /> 
  </fault>
  </operation>
  </binding>
- <!--  service 
  --> 
- <service name="SpecificCalculatorService">
- <port name="SpecificCalculatorPort" binding="tns:SpecificCalculatorBinding">
  <soap:address location="http://ec2-67-202-9-24.compute-1.amazonaws.com:8180/calculator/services/SpecificCalculatorService" /> 
  </port>
  </service>
  </definitions>

 
brad4dbrad4d


That wsdl generates the following APEX class
Code:
//Generated by wsdl2apex

public class bhmSpecificCalculatorServicesKronosCom {
public class UnitsTypeEnum {
}
public class ComputedPayCodeEditType {
public String id;
public bhmSpecificCalculatorServicesKronosCom.ExceptionType[] exceptions;
private String[] id_type_info = new String[]{'id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] exceptions_type_info = new String[]{'exceptions','urn:specific_calculator-services-kronos-com:specific_calculator','ExceptionType','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'id','exceptions'};
}
public class SpecificCalculatorPort {
public String endpoint_x = 'http://ec2-67-202-9-24.compute-1.amazonaws.com:8180/calculator/services/SpecificCalculatorService';
private String[] ns_map_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator', 'bhmSpecificCalculatorServicesKronosCom'};
public bhmSpecificCalculatorServicesKronosCom.ComputedShiftType[] calculate(DateTime start_date,DateTime end_date,DateTime now,bhmSpecificCalculatorServicesKronosCom.PunchType[] PunchType,bhmSpecificCalculatorServicesKronosCom.PayCodeEditType[] pay_code_edits,bhmSpecificCalculatorServicesKronosCom.ScheduledShiftType[] scheduled_shifts) {
bhmSpecificCalculatorServicesKronosCom.CalculateRequest_element request_x = new bhmSpecificCalculatorServicesKronosCom.CalculateRequest_element();
bhmSpecificCalculatorServicesKronosCom.CalculateResponse_element response_x;
request_x.start_date = start_date;
request_x.end_date = end_date;
request_x.now = now;
request_x.PunchType = PunchType;
request_x.pay_code_edits = pay_code_edits;
request_x.scheduled_shifts = scheduled_shifts;
Map<String, bhmSpecificCalculatorServicesKronosCom.CalculateResponse_element> response_map_x = new Map<String, bhmSpecificCalculatorServicesKronosCom.CalculateResponse_element>();
response_map_x.put('response_x', response_x);
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'/calculate',
'urn:specific_calculator-services-kronos-com:specific_calculator',
'CalculateRequest',
'urn:specific_calculator-services-kronos-com:specific_calculator',
'CalculateResponse',
'bhmSpecificCalculatorServicesKronosCom.CalculateResponse_element'}
);
response_x = response_map_x.get('response_x');
return response_x.computed_shifts;
}
}
public class BadInputFault_element {
public String code;
public String message;
private String[] code_type_info = new String[]{'code','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] message_type_info = new String[]{'message','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'code','message'};
}
public class PunchType {
public String id;
public DateTime effective_date;
public String punch_direction;
private String[] id_type_info = new String[]{'id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] effective_date_type_info = new String[]{'effective_date','http://www.w3.org/2001/XMLSchema','dateTime','1','1','false'};
private String[] punch_direction_type_info = new String[]{'punch_direction','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'id','effective_date','punch_direction'};
}
public class ExceptionType {
public String rule_id;
public String resource_name;
private String[] rule_id_type_info = new String[]{'rule_id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] resource_name_type_info = new String[]{'resource_name','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'rule_id','resource_name'};
}
public class CalculateResponse_element {
public bhmSpecificCalculatorServicesKronosCom.ComputedShiftType[] computed_shifts;
private String[] computed_shifts_type_info = new String[]{'computed_shifts','urn:specific_calculator-services-kronos-com:specific_calculator','ComputedShiftType','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'computed_shifts'};
}
public class CalculateRequest_element {
public DateTime start_date;
public DateTime end_date;
public DateTime now;
public bhmSpecificCalculatorServicesKronosCom.PunchType[] PunchType;
public bhmSpecificCalculatorServicesKronosCom.PayCodeEditType[] pay_code_edits;
public bhmSpecificCalculatorServicesKronosCom.ScheduledShiftType[] scheduled_shifts;
private String[] start_date_type_info = new String[]{'start_date','http://www.w3.org/2001/XMLSchema','dateTime','1','1','false'};
private String[] end_date_type_info = new String[]{'end_date','http://www.w3.org/2001/XMLSchema','dateTime','1','1','false'};
private String[] now_type_info = new String[]{'now','http://www.w3.org/2001/XMLSchema','dateTime','1','1','false'};
private String[] PunchType_type_info = new String[]{'PunchType','urn:specific_calculator-services-kronos-com:specific_calculator','PunchType','0','-1','false'};
private String[] pay_code_edits_type_info = new String[]{'pay_code_edits','urn:specific_calculator-services-kronos-com:specific_calculator','PayCodeEditType','0','-1','false'};
private String[] scheduled_shifts_type_info = new String[]{'scheduled_shifts','urn:specific_calculator-services-kronos-com:specific_calculator','ScheduledShiftType','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'start_date','end_date','now','PunchType','pay_code_edits','scheduled_shifts'};
}
public class PunchDirectionEnum {
}
.
.
.
.

 public class ComputedBreakType {
public String id;
public String pay_code;
public DateTime start_date;
public DateTime end_date;
public bhmSpecificCalculatorServicesKronosCom.ComputedPunchType start_punch;
public bhmSpecificCalculatorServicesKronosCom.ComputedPunchType end_punch;
public bhmSpecificCalculatorServicesKronosCom.ExceptionType[] exceptions;
public bhmSpecificCalculatorServicesKronosCom.TotalType[] totals;
private String[] id_type_info = new String[]{'id','http://www.w3.org/2001/XMLSchema','string','1','1','false'};
private String[] pay_code_type_info = new String[]{'pay_code','http://www.w3.org/2001/XMLSchema','string','0','1','false'};
private String[] start_date_type_info = new String[]{'start_date','http://www.w3.org/2001/XMLSchema','dateTime','0','1','false'};
private String[] end_date_type_info = new String[]{'end_date','http://www.w3.org/2001/XMLSchema','dateTime','0','1','false'};
private String[] start_punch_type_info = new String[]{'start_punch','urn:specific_calculator-services-kronos-com:specific_calculator','ComputedPunchType','0','1','false'};
private String[] end_punch_type_info = new String[]{'end_punch','urn:specific_calculator-services-kronos-com:specific_calculator','ComputedPunchType','0','1','false'};
private String[] exceptions_type_info = new String[]{'exceptions','urn:specific_calculator-services-kronos-com:specific_calculator','ExceptionType','0','-1','false'};
private String[] totals_type_info = new String[]{'totals','urn:specific_calculator-services-kronos-com:specific_calculator','TotalType','0','-1','false'};
private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','false'};
private String[] field_order_type_info = new String[]{'id','pay_code','start_date','end_date','start_punch','end_punch','exceptions','totals'};
}
}

 


brad4dbrad4d

which generates the following SOAP on the request:
Code:
<—xml version="1.0" encoding="UTF-8"–>
<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>
<CalculateRequest xmlns="urn:specific_calculator-services-kronos-com:specific_calculator">
<start_date>2008-02-05T14:00:00.000Z</start_date>
<end_date>2008-02-06T02:00:00.000Z</end_date>
<now>2008-02-05T14:13:30.102Z</now>
<punches>
<id>123</id>
<effective_date>2008-02-05T16:10:00.000Z</effective_date>
<punch_direction>IN</punch_direction>
</punches>
<punches>
<id>127</id>
<effective_date>2008-02-05T23:50:00.000Z</effective_date>
<punch_direction>OUT</punch_direction>
</punches>
<pay_code_edits>
<id />
<pay_code_category />
<pay_code />
<start_date />
<end_date />
</pay_code_edits>
<scheduled_shifts>
<id>345</id>
<pay_code_category>hourly</pay_code_category>
<pay_code>TestPayCode</pay_code>
<start_date>2008-02-05T16:00:00.000Z</start_date>
<end_date>2008-02-06T00:00:00.000Z</end_date>
<duration>
<amount>8.0</amount>
<units>HOURS</units>
</duration>
<breaks>
<id />
<pay_code />
<start_date />
<end_date />
</breaks>
</scheduled_shifts>
</CalculateRequest>
</env:Body>
</env:Envelope>


 


brad4dbrad4d

Unfortunately, the webservice wants:


 
Code:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Body>

<CalculateRequest xmlns="urn:specific_calculator-services-kronos-com:specific_calculator">

<start_date xmlns="">2008-01-01T00:00:00</start_date>

<end_date xmlns="">2008-01-31T00:00:00</end_date>

<now xmlns="">2008-02-05T07:44:44.1718288-08:00</now>

<punches xmlns="">

<id>10810fe4-dfc5-dc11-9ebe-0003ffb80cdf</id>

<effective_date>2008-01-25T08:23:00-08:00</effective_date>

<punch_direction>IN</punch_direction>

</punches>

<punches xmlns="">

<id>b1d8cb22-e2c5-dc11-9ebe-0003ffb80cdf</id>

<effective_date>2008-01-25T16:30:00-08:00</effective_date>

<punch_direction>OUT</punch_direction>

</punches>

<punches xmlns="">

<id>b0bde853-ebd3-dc11-bc8b-0003ffb80cdf</id>

<effective_date>2008-01-25T10:01:00-08:00</effective_date>

<punch_direction>OUT</punch_direction>

</punches>

<punches xmlns="">

<id>a0ee4a6c-ebd3-dc11-bc8b-0003ffb80cdf</id>

<effective_date>2008-01-25T10:14:00-08:00</effective_date>

<punch_direction>IN</punch_direction>

</punches>

<pay_code_edits xmlns="">

<id>f0a51f27-a9ca-dc11-bc8b-0003ffb80cdf</id>

<pay_code>a31125eb-ddc5-dc11-9ebe-0003ffb80cdf</pay_code>

<duration>

<amount>8</amount>

<units>HOURS</units>

</duration>

</pay_code_edits>

<scheduled_shifts xmlns="">

<id>b0b815dc-b0ca-dc11-bc8b-0003ffb80cdf</id>

<pay_code>a11125eb-ddc5-dc11-9ebe-0003ffb80cdf</pay_code>

<start_date>2008-01-25T08:00:00-08:00</start_date>

<end_date>2008-01-25T17:00:00-08:00</end_date>

<breaks>

<id>c0c9aa8a-48cb-dc11-bc8b-0003ffb80cdf</id>

<pay_code>Break</pay_code>

<start_date>2008-01-25T10:00:00-08:00</start_date>

<end_date>2008-01-25T10:15:00-08:00</end_date>

</breaks>

</scheduled_shifts>

</CalculateRequest>

</soap:Body>

</soap:Envelope>





 



or :
Code:
<soapenv:Envelope
xmlns:q0="urn:specific_calculator-services-kronos-com:specific_calculator"
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:Body>
<q0:CalculateRequest>
<start_date>2008-02-04T09:47:09.898Z</start_date>
<end_date>2008-02-06T23:47:16.882Z</end_date>
<now>2008-02-04T19:47:44.240Z</now>
<punches>
<id>p10</id>
<effective_date>
2008-02-04T13:48:03.083Z
</effective_date>
<punch_direction>IN</punch_direction>
</punches>
<punches>
<id>p11</id>
<effective_date>
2008-02-04T20:48:29.878Z
</effective_date>
<punch_direction>OUT</punch_direction>
</punches>
<pay_code_edits>
<id></id>
<pay_code_category>work</pay_code_category>
<pay_code>reg</pay_code>
<start_date>2008-02-05T16:49:05.111Z</start_date>
<duration>
<amount>4</amount>
<units>HOURS</units>
</duration>
</pay_code_edits>
<scheduled_shifts>
<id>s1</id>
<pay_code_category>work</pay_code_category>
<pay_code>reg</pay_code>
<start_date>2008-02-05T12:50:14.075Z</start_date>
<end_date>2008-02-05T22:50:28.121Z</end_date>
</scheduled_shifts>
<scheduled_shifts>
<id>s2</id>
<pay_code_category>work</pay_code_category>
<pay_code>reg</pay_code>
<start_date>2008-02-04T12:52:09.038Z</start_date>
<end_date>2008-02-04T22:52:26.724Z</end_date>
</scheduled_shifts>
</q0:CalculateRequest>
</soapenv:Body>

</soapenv:Envelope>

 



The problem is in the declaration of the Namespaces.  The elements within the complex types do not have a namespace and therefore must be removed from their parent's namespace by the null namespace declaration xmlns='' or the use of the q0: specification on the tags.  I cannot seem to control the generation of the soap by editing the apex_schema_type_info declaration in the apex code.  All changes I make to that part of the apex code seem to be completely ignored.
Bernard FarrellBernard Farrell
Note that the code that specifies the namespace is here in the generated WSDL
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '/calculate',
              'urn:specific_calculator-services-kronos-com:specific_calculator',
              'CalculateRequest',
              'urn:specific_calculator-services-kronos-com:specific_calculator',
              'CalculateResponse',
              'specificCalculatorServicesKronosCom.CalculateResponse_element'}
            );

In generated Apex it seems that you might be able to change the namespace for the type by modifying the statement highlighted below
    public class CalculateRequest_element {
        public DateTime start_date;
        public specificCalculatorServicesKronosCom.ScheduledShiftType[] scheduled_shifts;
        private String[] start_date_type_info = new String[]{'start_date','http://www.w3.org/2001/XMLSchema','dateTime','1','1','false'};
        private String[] scheduled_shifts_type_info = new String[]{'scheduled_shifts','urn:specific_calculator-services-kronos-com:specific_calculator','ScheduledShiftType','0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'urn:specific_calculator-services-kronos-com:specific_calculator','true'};
        private String[] field_order_type_info = new String[]{'start_date','end_date','now','punches','pay_code_edits','scheduled_shifts'};
    }


But you can change both parameters or even remove the declaration and it makes no difference to the generated WSDL.

This is very frustrating. I would love to see some documentation about things like the WebServiceCallout class and the ability to control the namespacing to a finer degree.
cheenathcheenath
I think changing the namespace wont help here. This problem is happening becuse the
service is expecting unqualified elements. Do you have control over this service? Can
you change the service schema to be qualified?:

<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" 
targetNamespace="urn:specific_calculator-services-kronos-com:specific_calculator"
elementFormDefault="unqualified" "qualified"
attributeFormDefault="unqualified">