如何在wadl发布请求中插入实体正文?

时间:2019-07-04 16:36:44

标签: json xml schema soapui wadl

我正在尝试使用wadl文件进行其余的Web服务调用。我正在使用soapUI工具生成一个wadl文件,该文件仅包含一个具有与之关联的主体的授权实体。当我从soapUI导入我的wadl文件时,我没有在wadl文件中显示主体内容。问题是我必须为Authorization实体传递json主体。任何帮助将是适当的。

自从我对xml和wadl文件有了新的了解以来,我的知识有限。

这是我从SoapUI获得的样本wadl

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://wadl.dev.java.net/2009/02">
  <doc xml:lang="en" title="https://login.google.com"/>
  <grammars>
  <xs:schema attributeFormDefault="unqualified" 
elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Output">
    <xs:complexType>
      <xs:sequence>
        <xs:element type="xs:byte" name="apiVersion"/>
        <xs:element type="xs:string" name="columnDelimiter"/>
        <xs:element type="xs:string" name="concurrencyMode"/>
        <xs:element type="xs:string" name="contentType"/>
        <xs:element type="xs:string" name="contentUrl"/>
        <xs:element type="xs:string" name="createdById"/>
        <xs:element type="xs:string" name="createdDate"/>
        <xs:element type="xs:string" name="externalIdFieldName"/>
        <xs:element type="xs:string" name="id"/>
        <xs:element type="xs:string" name="lineEnding"/>
        <xs:element type="xs:string" name="object"/>
        <xs:element type="xs:string" name="operation"/>
        <xs:element type="xs:string" name="state"/>
        <xs:element type="xs:string" name="systemModstamp"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 </grammars>
  <resources base="https://login.google.com">
    <resource path="content/objects" id="Ingest">
      <doc xml:lang="en" title="jobs/ingest"/>
      <param name="Authorization" type="xs:string" required="true"   default="" style="header" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
      <method name="POST" id="jobid">
        <doc xml:lang="en" title="1"/>
        <request>
          <representation mediaType="application/json"/>
        </request>
        <response status="200">
          <representation mediaType="text/html; charset=UTF-8"/>
          <representation mediaType="application/json;charset=UTF-8"   element="Output" xmlns:xs="http://www.w3.org/2001/XMLSchema"/>
        </response>
      </method>
    </resource>
  </resources>
</application>

这是我在SoapUI中的json正文内容

{
    "operation" : "upsert",
    "object" : "Customer_Promise_date__c",
    "externalIdFieldName": "External_ID__c",
    "contentType" : "CSV",
    "lineEnding" : "CRLF",
    "columnDelimiter" : "COMMA"
 }

这是json模式

    {"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"title": "The Root Schema",
"required": [
  "operation",
  "object",
 "externalIdFieldName",
 "contentType",
 "lineEnding",
 "columnDelimiter"], "properties": {
 "operation": {
   "$id": "#/properties/operation",
   "type": "string",
   "title": "The Operation Schema",
   "default": "",
   "examples": [
     "upsert"
   ],
   "pattern": "^(.*)$"
 },
 "object": {
   "$id": "#/properties/object",
   "type": "string",
   "title": "The Object Schema",
   "default": "",
   "examples": [
     "Customer_Promise_date__c"
   ],
   "pattern": "^(.*)$"
 },
 "externalIdFieldName": {
   "$id": "#/properties/externalIdFieldName",
   "type": "string",
   "title": "The Externalidfieldname Schema",
   "default": "",
   "examples": [
     "External_ID__c"
   ],
   "pattern": "^(.*)$"
 },
 "contentType": {
   "$id": "#/properties/contentType",
   "type": "string",
   "title": "The Contenttype Schema",
   "default": "",
   "examples": [
     "CSV"
   ],
   "pattern": "^(.*)$"
 },
 "lineEnding": {
   "$id": "#/properties/lineEnding",
   "type": "string",
   "title": "The Lineending Schema",
   "default": "",
   "examples": [
     "CRLF"
   ],
   "pattern": "^(.*)$"
 },
 "columnDelimiter": {
   "$id": "#/properties/columnDelimiter",
   "type": "string",
   "title": "The Columndelimiter Schema",
   "default": "",
   "examples": [
     "COMMA"
   ],
   "pattern": "^(.*)$"
 }}}

现在,我必须将此json模式作为授权实体的主体。

我遇到此错误

HTTP错误400错误的请求错误错误代码:API错误,消息:HTTP正文是必需的,但请求没有实体正文

0 个答案:

没有答案