2

I need to perform a Post request. While it's working with Curl in Terminal, I struggle to get it working in AngularJS.

curl -H ‘Content-type: xml’ -XPOST -d@’xmlDoc.xml’ http://localhost:8080/geoserver/wps

I tried:

                   $http({
                        method: 'POST',
                        url: 'http://localhost:8080/geoserver/wps/',
                        data: xmlDoc,
                        headers: {'Content-Type': 'application/xml'}
                    }).success(function (data, status, headers, config) {
                      [...]
                    }).error(function (data, status, headers, config) {
                      [...]
                    });

and also:

                     $http.post('http://localhost:8080/geoserver/wps', requestXML)
                     .success(function (data, status, headers, config) {
                     [...]
                     }).error(function (data, status, headers, config) {
                     [...]
                     });

But the response is always:

    <ows:Exception exceptionCode="NoApplicableCode">
            <ows:ExceptionText>org.xmlpull.v1.XmlPullParserException: only whitespace content 
    allowed before start tag and not { (position: START_DOCUMENT seen {... @1:1)  
</ows:ExceptionText>

Do I have to write the curl code into a seperate PHP file and call it from angular?

Antivist
  • 184
  • 9

0 Answers0