首页 \ 问答 \ 如何在Windows 7中使用cmd使用cURL发布XML数据?(How to post XML data with cURL using cmd in windows 7?)

如何在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
更新时间:2022-01-28 18:01

最满意答案

我只是因为比我更好的人还没有进入。 没有什么能比那些试图惹别别人的人更快得到好的答案。 ;-)

什么形式显示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进行启动和运行(该指南涵盖了基本配置以及第一个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 ...
  • 我的理解如下:您的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配置文 ...
  • 我只是因为比我更好的人还没有进入。 没有什么能比那些试图惹别别人的人更快得到好的答案。 ;-) 什么形式显示BooArray采取? 如果它实际上是一个包含键:值对的对象,它应该作为一系列GET参数和值进入服务器。 如果它只是一个原始的JavaScript数组,我认为你不能这样做。 但是,一般情况下,一旦您将有效数据发送到服务器,它将作为GET参数进入,您将使用某种方法获取它们。 我不知道你的Stripes方法是否正在这样做。 同样,一般来说,理论上你可以有一个创建数组的方法,或者创建一个字符串的方法(用逗号 ...
  • 通常这样的问题是由不正确的web.xml文件引起的,或者是由不在类路径中的必需JAR文件引起的。 如果检查Tomcat的日志目录(应该在CATALINA_HOME / logs下),您应该找到一些名为“ .log”的日志文件(例如,“localhost.2011-03-18.log”)。 在当前日志文件中,您可能会找到一个堆栈跟踪,它将提供有关错误确切原因的更多详细信息。 Usually issues like this are caused by either an in ...
  • 如果要将表单提交给服务器,可以使用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.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)