lula / ngx-soap

Simple SOAP client for Angular
MIT License
66 stars 60 forks source link

"Error: Non-whitespace before first tag. Line: 1 Column: 1 Char: -" #45

Open BartoszDabek opened 5 years ago

BartoszDabek commented 5 years ago

Hey guys,

I'm using Angular 7 and trying to invoke method on my SOAP service which is written in Java. The problem occurs during response. On server everything looks ok, the object is passed back to the client but unfortunately I retrieve fault: issue

That's the code I'm using:

import { Component } from '@angular/core';
import { NgxSoapService, ISoapMethod, Client, ISoapMethodResponse } from 'ngx-soap';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'my-dream-app';
  client: Client;

    constructor(private soap: NgxSoapService) {
      console.log("Constructor called")
      this.soap.createClient('http://localhost:8080/AirportTicket/hello?wsdl')
        .then(client => {
          console.log('Client', client);
          this.client = client;

          this.newFlight();
        })
        .catch(err => console.log('Error', err));
    }

    newFlight() {
      const body = {
        arg0: "Wroclaw",
        arg1: "Bialystok",
        arg2: "2007-12-03T10:15:30"
      };

      this.client.call('enterNewFlight', body).subscribe(res => {
        console.log(res);
      }, err => console.log(err));
    }
}
BartoszDabek commented 5 years ago

I found it's related to enabled MTOM on server, however I don't know how to deal with it. Any ideas?

rtrcode commented 5 years ago

you have MTOM in the body section. You should only have soap part in there. It is expecting starting from : <soap:Envelope... It's related with MTOM support. We have the same issue.

adityatyagi commented 4 years ago

Any leads on this? I am facing a similar issue