Forum Discussion

Herminator's avatar
12 years ago

Some requests return HTLM status 400

Hello all,

Although not very experienced with XML / WebServices I was asked to look into a issue where ASP 3.5 webservice sometimes returnes a 400 'Bad Request'.
Along with the issue I recieved an example of an accepted xml message, one with a rejected xml message.

I decided to test both xml messages against the webservice with SoapUI, with which I'm pretty unfamiliar with.
I created a project based on the wsdl copied in the both xml messages and guess what BOTH files gave me a 400 - bad request.

SoapUI validation of both the sample requests tell me "line 4: XML declaration is not well formed" on the first line of the xml I pasted into the Soap envelope; "<?xml version="1.0" encoding="ISO-8859-1"?>".

After removing the XML declarations SoapUI Validiation succeedes an BOTH message were accepted and processed by the webservice when submitting the request???

Question 1: If understand correct the xml declaration should not be included in the soap envelope?

Question 2: Why is the xml message reported to be rejected with 400 - bad request succesfully accepted and processed by the webservice?

The xml file reported to be rejected:
<?xml version="1.0" encoding="ISO-8859-1"?>
<Invoice xmlns="http://www.openapplications.org/oagis" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hrx="http://ns.hr-xml.org/2007-04-15" xmlns:nl="http://ns.hr-xml.org/2007-04-15" xsi:schemaLocation="http://www.openapplications.org/oagis ../Invoice.xsd http://ns.hr-xml.org/2007-04-15 InvoiceAdditionalNL.xsd">
<Header>
<DocumentIds>
<DocumentId>
<Id>2600250764</Id>
</DocumentId>
</DocumentIds>
<DocumentDateTime>2011-09-30T00:00:00Z</DocumentDateTime>
<ReasonCode>hours</ReasonCode>
<TotalAmount currency="EUR">1313.90</TotalAmount>
<PaymentTerms>
<PaymentTermsDate>2011-09-30T00:00:00Z</PaymentTermsDate>
<NumberOfDays>30</NumberOfDays>
</PaymentTerms>
<Parties>
<CustomerParty>
<PartyId>
<Id>minfin</Id>
</PartyId>
<Name><![CDATA[Ministerie van Financiƫn]]></Name>
<Addresses>
<PrimaryAddress>
<AddressLine><![CDATA[Postbus 20201]]></AddressLine>
<City><![CDATA['S-GRAVENHAGE]]></City>
<PostalCode>2500 EE</PostalCode>
<Telephone>070-3428969</Telephone>
</PrimaryAddress>
</Addresses>
<Contacts>
<Contact>
<Description><![CDATA[CREDITEURENADMINISTRATIE]]></Description>
</Contact>
</Contacts>
</CustomerParty>
<RemitToParty>
<PartyId>
<Id>1</Id>
</PartyId>
<Name><![CDATA[Start People BV]]></Name>
<TaxId>NL804898509B01</TaxId>
<Addresses>
<PrimaryAddress>
<AddressLine><![CDATA[P.J. Oudweg 61]]></AddressLine>
<City><![CDATA[ALMERE]]></City>
<Country><![CDATA[NL]]></Country>
<PostalCode>1314 CK</PostalCode>
<Description>Hoofdkantoor</Description>
<Telephone>036-5299300</Telephone>
<FaxNumber>036-5299309</FaxNumber>
</PrimaryAddress>
<SecondaryAddress>
<AddressLine><![CDATA[Postbus 1]]></AddressLine>
<City><![CDATA[ALMERE]]></City>
<Country><![CDATA[NL]]></Country>
<PostalCode>1300 AA</PostalCode>
</SecondaryAddress>
</Addresses>
<Contacts>
<Contact>
<Description><![CDATA[IFAR CCP]]></Description>
<Addresses>
<PrimaryAddress>
<AddressLine><![CDATA[Koninginnegracht 62]]></AddressLine>
<City><![CDATA['S-GRAVENHAGE]]></City>
<Country><![CDATA[NL]]></Country>
<PostalCode>2514 AG</PostalCode>
<Description>Vestiging</Description>
<Telephone>070-3102728</Telephone>
<FaxNumber>070-3102727</FaxNumber>
</PrimaryAddress>
<SecondaryAddress/>
</Addresses>
</Contact>
</Contacts>
</RemitToParty>
</Parties>
<Type>Debit</Type>
<Reason>regular</Reason>
<TotalCharges currency="EUR">1104.12</TotalCharges>
<TotalTax currency="EUR">209.78</TotalTax>
<Tax>
<TaxAmount currency="EUR">209.78</TaxAmount>
<TaxBaseAmount currency="EUR">1104.12</TaxBaseAmount>
<PercentQuantity uom="BTW">19.00</PercentQuantity>
</Tax>
<UserArea>
<StaffingAdditionalData xmlns="http://ns.hr-xml.org/2007-04-15">
<CustomerReportingRequirements>
<CostCenterCode/>
</CustomerReportingRequirements>
<ReferenceInformation>
<StaffingSupplierId idOwner="StaffingCustomer">
<IdValue><![CDATA[1]]></IdValue>
</StaffingSupplierId>
<StaffingCustomerId idOwner="StaffingCustomer">
<IdValue><![CDATA[minfin]]></IdValue>
</StaffingCustomerId>
<StaffingCustomerOrgUnitId idOwner="StaffingCustomer">
<IdValue name="Ministerie van Financiƫn"><![CDATA[Start People IFAR]]></IdValue>
</StaffingCustomerOrgUnitId>
</ReferenceInformation>
</StaffingAdditionalData>
<StaffingOrganization typeOfOrganization="Supplier" xmlns="http://ns.hr-xml.org/2007-04-15">
<Organization>
<OrganizationName><![CDATA[Start People BV]]></OrganizationName>
</Organization>
<PaymentInfo>
<BankAccountInfo>
<BankInfoByJurisdiction bankJurisdiction="NL">
<BankCode/>
<BankWindow/>
<BankAccountNumber>667411135</BankAccountNumber>
<BankAccountKey/>
</BankInfoByJurisdiction>
<BankAccountForeign/>
</BankAccountInfo>
</PaymentInfo>
</StaffingOrganization>
<StaffingOrganizationNL xmlns="http://ns.hr-xml.org/2007-04-15">
<ChamberofCommerceReference>29031500</ChamberofCommerceReference>
</StaffingOrganizationNL>
</UserArea>
</Header>
<Line>
<LineNumber>1</LineNumber>
<ReasonCode/>
<Charges>
<TotalCharge>
<Total currency="EUR">1104.12</Total>
</TotalCharge>
</Charges>
<Line>
<LineNumber>1A</LineNumber>
<Charges>
<TotalCharge>
<Total currency="EUR">1104.12</Total>
</TotalCharge>
</Charges>
<Tax>
<PercentQuantity uom="BTW">19.00</PercentQuantity>
</Tax>
<Price>
<Amount currency="EUR">30.67</Amount>
<PerQuantity uom="regular">1</PerQuantity>
</Price>
<ItemQuantity uom="regular">36.00</ItemQuantity>
</Line>
<UserArea>
<TimeCard xmlns="http://ns.hr-xml.org/2007-04-15">
<Id idOwner="StaffingCustomer">
<IdValue>10019142</IdValue>
</Id>
<ReportedResource>
<Person>
<Id idOwner="StaffingCustomer">
<IdValue>BOS0000732</IdValue>
</Id>
<PersonName>
<FormattedName><![CDATA[C.M. Bosscher]]></FormattedName>
<LegalName><![CDATA[C.M. Bosscher]]></LegalName>
<GivenName><![CDATA[Claudia]]></GivenName>
<PreferredGivenName><![CDATA[Claudia]]></PreferredGivenName>
<FamilyName><![CDATA[Bosscher]]></FamilyName>
</PersonName>
</Person>
</ReportedResource>
<ReportedTime>
<PeriodStartDate>2011-09-26T00:00:00Z</PeriodStartDate>
<PeriodEndDate>2011-09-30T00:00:00Z</PeriodEndDate>
<TimeInterval type="regular" billable="true">
<StartDateTime>2011-09-26T00:00:00Z</StartDateTime>
<EndDateTime>2011-09-30T00:00:00Z</EndDateTime>
<Duration>36.00</Duration>
<RateOrAmount currency="EUR" type="Hourly" multiplier="100.00">30.67</RateOrAmount>
<AdditionalData>
<CustomerReportingRequirements>
<PurchaseOrderLineItem>0</PurchaseOrderLineItem>
</CustomerReportingRequirements>
</AdditionalData>
</TimeInterval>
</ReportedTime>
<SubmitterInfo>
<SubmittedDateTime>2011-10-03</SubmittedDateTime>
</SubmitterInfo>
<AdditionalData>
<StaffingAdditionalData xmlns="http://ns.hr-xml.org/2007-04-15">
<CustomerReportingRequirements>
<PurchaseOrderNumber/>
<CostCenterCode/>
<ProjectCode/>
</CustomerReportingRequirements>
<ReferenceInformation>
<AssignmentId idOwner="StaffingCompany">
<IdValue>2600026589</IdValue>
</AssignmentId>
</ReferenceInformation>
</StaffingAdditionalData>
</AdditionalData>
</TimeCard>
<StaffingAdditionalData xmlns="http://ns.hr-xml.org/2007-04-15">
<CustomerReportingRequirements>
<PurchaseOrderNumber/>
<CostCenterCode/>
<ProjectCode/>
</CustomerReportingRequirements>
</StaffingAdditionalData>
</UserArea>
</Line>
</Invoice>

I think the reported rejection has to do something with the Ć« character in the line
<Name><![CDATA[Ministerie van Financiƫn]]></Name>

But why is it not rejected when send using SoapUI??

Thanks anyone for pointing me to the right direction in finding the solution to this problem!
No RepliesBe the first to reply