README
¶
Go Soap

package to help with SOAP integrations (client)
Credits
This project is an adaptation of the github.com/tiaguinho/gosoap, to meet the specific needs of Infor Sunsystems Connect SSC
Install
go get github.com/UnionMexicanaDelNorte/soapClientGolangForSSC
Example
soap, err := gosoap.SoapClient("http://localhost:8080/connect/wsdl/SecurityProvider?wsdl","http://localhost:8080/connect/soap/SecurityProvider")
if err != nil {
fmt.Errorf("error not expected: %s", err)
}
params := gosoap.Params{
"name": "AOK",
"password" : "",
}
err = soap.Call("Authenticate", "SecurityProviderAuthenticateRequest", params)
if err != nil {
fmt.Errorf("error in soap call: %s", err)
}
vaucher := soap.GetResponse()
fmt.Println(vaucher)
soapJournal, err := gosoap.SoapClient("http://localhost:8080/connect/wsdl/ComponentExecutor?wsdl","http://localhost:8080/connect/soap/ComponentExecutor")
if err != nil {
fmt.Errorf("error not expected: %s", err)
}
params = gosoap.Params{
"authentication": vaucher,
"licensing" : "",
"component" : "Journal",
"method" : "Import",
"group" : "",
"payload" : `<SSC>
<SunSystemsContext>
<BusinessUnit>CEA</BusinessUnit>
<BudgetCode>A</BudgetCode>
</SunSystemsContext>
<MethodContext>
<LedgerPostingParameters>
<JournalType>JV</JournalType>
<PostingType>2</PostingType>
<PostProvisional>N</PostProvisional>
<PostToHold>N</PostToHold>
<BalancingOptions>T2</BalancingOptions>
<SuspenseAccount>338100</SuspenseAccount>
<TransactionAmountAccount>338100</TransactionAmountAccount>
<ReportingAccount>338100</ReportingAccount>
<SupressSubstitutedMessages>N</SupressSubstitutedMessages>
<ReportErrorsOnly>Y</ReportErrorsOnly>
</LedgerPostingParameters>
</MethodContext>
<Payload>
<Ledger>
<Line>
<TransactionReference>651C</TransactionReference>
<AccountingPeriod>0052017</AccountingPeriod>
<TransactionDate>07052017</TransactionDate>
<AccountCode>ERROJAB01</AccountCode>
<AnalysisCode2/>
<AnalysisCode3>10</AnalysisCode3>
<AnalysisCode4/>
<AnalysisCode5/>
<AnalysisCode6/>
<AnalysisCode7/>
<AnalysisCode8/>
<AnalysisCode9/>
<AnalysisCode10/>
<Description>GONZALEZ ALCUDIA HUMBERTO</Description>
<Value4Amount>3500</Value4Amount>
<DebitCredit>D</DebitCredit>
<Value4CurrencyCode>MXP1</Value4CurrencyCode>
<DueDate>07052017</DueDate>
</Line>
<Line>
<TransactionReference>651C</TransactionReference>
<AccountingPeriod>0052017</AccountingPeriod>
<TransactionDate>07052017</TransactionDate>
<AccountCode>ERROJAB01</AccountCode>
<AnalysisCode2/>
<AnalysisCode3>10</AnalysisCode3>
<AnalysisCode4/>
<AnalysisCode5/>
<AnalysisCode6/>
<AnalysisCode7/>
<AnalysisCode8/>
<AnalysisCode9/>
<AnalysisCode10/>
<Description>GONZALEZ ALCUDIA HUMBERTO</Description>
<Value4Amount>3500</Value4Amount>
<DebitCredit>C</DebitCredit>
<Value4CurrencyCode>MXP1</Value4CurrencyCode>
<DueDate>07052017</DueDate>
</Line>
</Ledger>
</Payload>
</SSC>
`,
}
err = soapJournal.Call("Execute", "ComponentExecutorExecuteRequest", params)
if err != nil {
fmt.Errorf("error in soap call: %s", err)
}
diario := soapJournal.GetResponse()
fmt.Println(diario)
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { WSDL string URL string Method string EnvelopeTitle string Params Params Definitions *wsdlDefinitions Body []byte // contains filtered or unexported fields }
Client struct hold all the informations about WSDL, request and response of the server
func SoapClient ¶
SoapClient return new *Client to handle the requests with the WSDL
func (*Client) GetResponse ¶
Unmarshal get the body and unmarshal into the interface
func (Client) MarshalXML ¶
MarshalXML envelope the body and encode to xml
type Fault ¶
type Fault struct { Code string `xml:"faultcode"` Description string `xml:"faultstring"` Detail string `xml:"detail"` }
Fault response
type SoapBody ¶
type SoapBody struct { XMLName struct{} `xml:"Body"` Contents []byte `xml:",innerxml"` }
SoapBody struct
type SoapEnvelope ¶
type SoapEnvelope struct { XMLName struct{} `xml:"Envelope"` Body SoapBody }
SoapEnvelope struct
Click to show internal directories.
Click to hide internal directories.