如何击中并获得酒店军刀的肥皂api

时间:2016-06-20 10:49:55

标签: ruby-on-rails sabre

我是 Sabre dev studio API 的新手,并尝试在我的 ruby​​项目中使用,但我无法点击API 。如果您有任何想法,请让我解释一下 Sabre的SOAP API 的集成。我花了很多时间做这件事。 我使用 str ='<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Header> <eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version="1.0"> <eb:ConversationId/> <eb:From> <eb:PartyId type="urn:x12.org:IO5:01">999999</eb:PartyId> </eb:From> <eb:To> <eb:PartyId type="urn:x12.org:IO5:01">123123</eb:PartyId> </eb:To> <eb:CPAId>IPCC</eb:CPAId> <eb:Service eb:type="OTA">SessionCreateRQ</eb:Service> <eb:Action>SessionCreateRQ</eb:Action> <eb:MessageData> <eb:MessageId>1000</eb:MessageId> <eb:Timestamp>2001-02-15T11:15:12Z</eb:Timestamp> <eb:TimeToLive>2001-02-15T11:15:12Z</eb:TimeToLive> </eb:MessageData> </eb:MessageHeader> <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/12/utility"> <wsse:UsernameToken> <wsse:Username>USERNAME</wsse:Username> <wsse:Password>PASSWORD</wsse:Password> <Organization>IPCC</Organization> <Domain>DEFAULT</Domain> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <eb:Manifest SOAP-ENV:mustUnderstand="1" eb:version="1.0"> <eb:Reference xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="cid:rootelement" xlink:type="simple"/> </eb:Manifest> </SOAP-ENV:Body> </SOAP-ENV:Envelope>' client = Savon::Client.new(wsdl: "http://webservices.sabre.com/wsdl/sabreXML1.0.00/usg/SessionCreateRQ.wsdl") @result = client.call(:session_create_rq,:message=>Hash.from_xml(str)) 但无法获得军刀的回复。我已经使用了这段代码

(soap-env:Client.InvalidEbXmlMessage) Unable to create envelope from given source: Error on line 1 of document : Element "xmlns:SOAP_ENV" cannot have "xmlns" as its prefix. Nested exception: Element "xmlns:SOAP_ENV" cannot have "xmlns" as its prefix.

当我尝试发出请求时,这会导致错误

public class Book
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string UserId { get; set; }
    public virtual ApplicationUser User { get; set; }
    public string CourseId { get; set; }
    public virtual Course Course { get; set; }
}
public class Course
{
    public int Id { get; set; }
    public string CourseName { get; set; }
    public virtual ICollection<Book> Books { get; set; }
}
public class ApplicationUser : IdentityUser
{
    public bool Deleted { get; set; }
    public virtual ICollection<Book> Books { get; set; }
}
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }
    public DbSet<Book> Books { get; set; }
    public DbSet<Course> Courses { get; set;}
    protected override void OnModelCreating(ModelBuilder builder)
    {
        foreach (var entity in builder.Model.GetEntityTypes())
        {
            entity.Relational().TableName = entity.DisplayName();
        }
        base.OnModelCreating(builder);
    }
}

请建议我如何改进这一点以获得正确的答案。

0 个答案:

没有答案