Windows <;在这个时候是出乎意料的。将输入数据作为xml发布到rest服务时从curl命令行

Windows <;在这个时候是出乎意料的。将输入数据作为xml发布到rest服务时从curl命令行,windows,json,wcf,rest,curl,Windows,Json,Wcf,Rest,Curl,当我将原始字符串作为输入发布到JSON REST服务调用时,它正在执行ex: curl -d "{\"input1\": \"as\", \"input2\": \"ad\"}" -i -X POST -H "Content-Type:application/json" http://localhost/rtygies/Service1.svc/rest/receivedata1 但当我以xml作为输入发布时,它给出了如下错误: curl -d "{\"input1\": \"<x

当我将原始字符串作为输入发布到JSON REST服务调用时,它正在执行ex:

curl -d "{\"input1\": \"as\", \"input2\": \"ad\"}"  -i -X POST -H "Content-Type:application/json"  http://localhost/rtygies/Service1.svc/rest/receivedata1 
但当我以xml作为输入发布时,它给出了如下错误:

curl -d "{\"input1\": \"<xml></xml>\", \"input2\": \"<xml></xml>\"}"  -i -X POST -H "Content-Type:application/json"  http://localhost/rtygies/Service1.svc/rest/receivedata1 
curl-d“{\”input1\”:\”,\“input2\”:\“\”})-i-X POST-H“内容类型:application/json”http://localhost/rtygies/Service1.svc/rest/receivedata1 
错误:<此时意外发生

我在窗口中使用curl


有人能说如何从curl以JSON格式将xml作为字符串输入发布到Rest服务吗实际上,我不知道是什么情况, 但是我得到一个错误,说这次是出乎意料的 在windows上尝试以下命令时:

curl-u admin:password-XPOST-H'内容类型:text/xml'-d'newWorkspacehttp://geoserver.org' http://localhost:8080/geoserver/rest/namespaces

然后,我将单引号改为双引号,它成功了。

重定向符号可以通过“

试用

curl -d "{\"input1\": \""<xml></xml>"\", \"input2\": \""<xml></xml>"\"}"  -i -X POST -H "Content-Type:application/json"  http://localhost/rtygies/Service1.svc/rest/receivedata1
curl-d“{\”input1\:\”,“\”input2\:\“\”}“-i-X POST-H”内容类型:application/jsonhttp://localhost/rtygies/Service1.svc/rest/receivedata1

我在使用双引号时运气不好,但是使用^

所以你的卷发变成了

curl -d "{\"input1\": \"^<xml^>^</xml^>\", \"input2\": \"^<xml^>^</xml^>\"}"  -i -X POST -H "Content-Type:application/json"  http://localhost/rtygies/Service1.svc/rest/receivedata1
curl-d“{\”input1\”:\“^^\”,\“input2\”:\“^^\”}“-i-X POST-H”内容类型:application/jsonhttp://localhost/rtygies/Service1.svc/rest/receivedata1

我真是太感谢你了,帮我省去了很多挫折!
curl -d "{\"input1\": \"^<xml^>^</xml^>\", \"input2\": \"^<xml^>^</xml^>\"}"  -i -X POST -H "Content-Type:application/json"  http://localhost/rtygies/Service1.svc/rest/receivedata1