I am trying to submit to a newsoap service and keep recieving the following error
HTTP/1.1 400 Bad Request
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Mon, 03 Sep 2012 10:09:41 GMT

Function I have written looks like the following ($post_xml is shown below and $url is the url of the webservice):

function my_soap_submit($post_xml, $url){
    require_once('lib/nusoap.php');
    $client = new nusoap_client($url, false);
    $soapaction = "http://www.service_domain.co.za/FullApp";
    $msg = $client->serializeEnvelope($post_xml);
    $result = $client->send($msg, $soapaction);
    $err = $client->getError();
    if ($err) {
            echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
            echo $client->response;
            exit();
    }
    return $result;
} 

Here follows my xml:

<FullApp xmlns="http://www.service_domain.co.za/">
      <SourceAppNumber>211-211-103165-20120803-151534</SourceAppNumber>
      <SourceAppForm><NewAppDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Application  SourceSystemCode="TRADER"  TransactionIdentifier="TRADER" TransactionType="001" SourceAppNo="211-211-103165-20120803-151534" SubmitDate="20120903" SubmitTime="120941" VersionNo="002">
        <ApplicationDetail ApplicationType="STD" LoanTypeCode="LD145" Chain="101" BranchName="Staff Benefits" BranchNo="1101" InvoiceNo="0" InvoiceDate="18991230" AccCatLoanType="STL" DealerCode="MTM0002" RepCode="MTM0002">
            <FormalInvoice TotalValueOfGoods="MR" DealContractAmount="MR" />
            <PaymentDetails AccHolderSurname="" AccHolderInitials="" PaymentDeductionDate="1" PaymentMethod="Y">
                <BankAccountDetail BankName="" BranchCode="" AccountNo="" AccountType="S"/>
            </PaymentDetails>
            <MarketingOptions MarketingListIndicator="on" MarketingByEmail="on" MarketingByTelepone="N" LanguageForDocumentation="Afr" />
        </ApplicationDetail>
        <Applicant ApplicantType="INDIV" ClientId="1" PrimaryApplicant="y" Title="Mr" Surname="Vermeulen" Firstname="Daniel" Initials="D" DateOfBirth="19780228" IDType="R" IDNo="8110310539084" MaritalStatus="M" EmploymentStatus="F" OwnAMotorVehicle="y">
            <ContactDetail HomeTelCode="011" HomeTelNo="5234561" WorkTelCode="023" WorkTelNo="3472735" CellularNo="0739470814" />
            <Address>
                <ResidentialAddress PeriodOfResidence="1000">
                    <AddressDetail AddressLine1="38 Nighting Gale street" AddressLine2="Avianpark" Suburb="Worcester" TownCity="" PostCoce="6850"/>
                </ResidentialAddress>
                <PostalAddress PostalSameAsResidential="N">
                    <AddressDetail AddressLine1="38 Nigting Gale Street" AddressLine2="Avianpark" Suburb="Worcester" TownCity="" PostCoce="6850"/>
                </PostalAddress>
            </Address>
            <Employment>
                <CurrentEmployer EmployerName="Woolworths LTD" Occupation="Controller" PeriodAtEmployer="0300" />
            </Employment>
            <NextOfKin Title="Mev" Surname="Vermeulen" FirstName="Ronel" Relationship="Othr">
                <AddressDetail AddressLine1="38 Nightingele street" AddressLine2="Avianpark" Suburb="Worcester" TownCity="" PostCoce="6850"/>
                <ContactDetail HomeTelCode="" HomeTelNo="" WorkTelCode="" WorkTelNo="" CellularNo="0710774719" />
            </NextOfKin>
            <NextOfKin Title="" Surname="" FirstName="" Relationship="">
                <AddressDetail AddressLine1="" AddressLine2="" Suburb="" TownCity="" PostCoce=""/>
                <ContactDetail HomeTelCode="" HomeTelNo="" WorkTelCode="" WorkTelNo="" CellularNo="" />
            </NextOfKin>
            <Affordability>
                <AffordabilityIncome ApplicantSalary="4400" OverTime="0.00" Maintanance="0.00" RentalIncome="0.00" SpouseIncome="0.00" />

            </Affordability>
        </Applicant>
    </Application>
</NewAppDocument></SourceAppForm>
</FullApp>

Contact the provider of the service to see if some required fields (credentials, or logging in first) are missing. Another way to test this is to first use SoapUI so you can see what needs to be sent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.