如何在Windows 7中使用cmd使用cURL发布XML数据?(How to post XML data with cURL using cmd in windows 7?)
我试图在命令行上使用curl发布一些xml数据。 特别是我试图运行以下命令来连接到计费服务提供商:
curl https://core.spreedly.com/v1/gateways.xml \ -u 'secretKey' \ -H 'Content-Type: application/xml' \ -d '<gateway><gateway_type>test</gateway_type></gateway>'
但是我一直收到以下错误:
< was unexpected at this time.
我该如何输入我的xml数据?
I am trying to post some xml data using curl on command line. Particularly I m trying to run the following command to connect to a billing service provider:
curl https://core.spreedly.com/v1/gateways.xml \ -u 'secretKey' \ -H 'Content-Type: application/xml' \ -d '<gateway><gateway_type>test</gateway_type></gateway>'
However I m keep getting the following error:
< was unexpected at this time.
How should I type my xml data?
原文:https://stackoverflow.com/questions/17106996
最满意答案
我只是因为比我更好的人还没有进入。 没有什么能比那些试图惹别别人的人更快得到好的答案。 ;-)
什么形式显示BooArray采取? 如果它实际上是一个包含键:值对的对象,它应该作为一系列GET参数和值进入服务器。 如果它只是一个原始的JavaScript数组,我认为你不能这样做。
但是,一般情况下,一旦您将有效数据发送到服务器,它将作为GET参数进入,您将使用某种方法获取它们。 我不知道你的Stripes方法是否正在这样做。 同样,一般来说,理论上你可以有一个创建数组的方法,或者创建一个字符串的方法(用逗号分隔或类似)。 我想这取决于抓取GET参数值的方法。
I'm going to chime in only because better people than me have not yet. Nothing gets good answers quicker than someone trying to one-up someone else. ;-)
What form does displayedBoardArray take? If it's actually an object containing key:value pairs, it should come into the server as a series of GET parameters and values. If it's just a raw JavaScript array, I don't think you can do that.
In general, though, once you are sending valid data to the server, it will come in as GET parameter(s) which you will grab using some sort of method. I couldn't say if your Stripes method is doing that. Again, generally speaking, you can theoretically have a method that will create an array, or a method that will create a string (with comma separations or similar). I guess it depends on the method that's grabbing the GET parameter values.
相关问答
更多-
条纹框架[已关闭](Stripes Framework [closed])[2023-04-06]
官方的快速入门指南提供了一步一步的指南,让您可以使用Stripes进行启动和运行(该指南涵盖了基本配置以及第一个Stripes应用程序的开发)。 如果您不理解说明,那么我建议遵循@ seanizer的建议,并首先从Web层上的Java EE教程开始。 在进一步学习之前,你确实需要掌握基本技能。 不要把马车放在马前。 The official Quick Start Guide provides a step by step guide to get you up and running with Strip ... -
你可以省去二传手。 attachments变量已通过new运算符初始化。 private List
attachments = new ArrayList (); public List getAttachments() { return this.attachments; } public Resolution submit() { System.out.println("********************* Attach ... -
该问题与我正在使用的Enumerate Java类有关。 为了获取枚举值,我现在使用标准文档java.lang.Enum描述的name()方法。 现在使用name()我100%确定我得到一个String而不是任何其他类型/对象。 The issue was related to the Enumerate Java class I was using. In order to get the enumerate values I now use the name() method described in ...
-
如果您有验证错误并且条带不知道哪个页面发出请求,则会发生这种情况,因为它是ajax请求。验证后使用表单sumit表单提交。 还要尝试检查用户域中哪个验证失败。 This happens when you have validation error and stripe does not know which page issued the request as it is an ajax request.Use form sumit form submission after validation. Als ...
-
使用Stripes将JSP文件移动到WEB-INF目录时出错(Error moving JSP file into WEB-INF directory with Stripes)[2022-06-24]
我的理解如下:您的WelcomeActionBean不在一个包([web,www,stripes,action])中由NameBasedActionResolver (读取javadoc)自动处理,因此它实际上映射到/myapp/Welcome.action (如错误信息)。 因此,当您请求/Welcome.action ,没有任何现有的ActionBean绑定到该URL并且解析器回/welcome.jsp (再次参见NameBasedActionResolver javadoc)。 当你在/WEB-INF ... -
最后我得到了我的问题的答案,我必须纠正如下的数据源映射为jboss 7.1: -
java:jboss/datasources/eagle 对于Jboss 5它是: - hibernate.cfg.xml文件中的java:eagle 。 意味着数据库名称必须在standalone.xml和hibernate配置文 ... -
Java条带的getJSON数据(getJSON data for Java stripes)[2022-12-26]
我只是因为比我更好的人还没有进入。 没有什么能比那些试图惹别别人的人更快得到好的答案。 ;-) 什么形式显示BooArray采取? 如果它实际上是一个包含键:值对的对象,它应该作为一系列GET参数和值进入服务器。 如果它只是一个原始的JavaScript数组,我认为你不能这样做。 但是,一般情况下,一旦您将有效数据发送到服务器,它将作为GET参数进入,您将使用某种方法获取它们。 我不知道你的Stripes方法是否正在这样做。 同样,一般来说,理论上你可以有一个创建数组的方法,或者创建一个字符串的方法(用逗号 ... -
条纹错误(Error on Stripes)[2022-04-29]
通常这样的问题是由不正确的web.xml文件引起的,或者是由不在类路径中的必需JAR文件引起的。 如果检查Tomcat的日志目录(应该在CATALINA_HOME / logs下),您应该找到一些名为“。 .log”的日志文件(例如,“localhost.2011-03-18.log”)。 在当前日志文件中,您可能会找到一个堆栈跟踪,它将提供有关错误确切原因的更多详细信息。 Usually issues like this are caused by either an in ... -
将数据传递给jquery的getJSON()时出现问题 - 不接受map(Problems passing data to jquery's getJSON() - Will not accept map)[2021-11-12]
如果要将表单提交给服务器,可以使用jQuery的serialize() OR serializeArray()方法。 $.getJSON(inputURL, $(formName).serialize(), onReturnFunction); 如果元素名称匹配正确,则应该在表单bean中填充serialize / serializeArray方法返回的数据。 这是序列化方法的一个工作示例 (从jQuery网站复制) 来自BeanUtils.populate servlet方法的java.lang.Il ... -
好像你只是缺少Commons FileUpload 。 尝试将其添加到类路径中,看看它是否有效。 Seems like you're simply missing Commons FileUpload. Try adding it to your classpath and see if it works.