有没有人可以给我一个详细的RobinBuschmann/soap-typescript/soap-decorators例子。我希望为node-soap创建一个wsdl xml。在RobinBuschmann/soap-typescript的github上给出的例子似乎不能正常工作。我将前三个代码片段放在一个名为createWsdl.js的文件中,并使用"node createWsdl.js“运行它,然后得到一个错误。我怀疑我做得不对。有没有人可以帮助我,或者给我一个实际有效的详细例子。
发布于 2018-11-21 22:34:58
我使用node-soap和soap-decorators与Quickbook进行通信。下面是我的app.ts文件中的内容:
this.express.use(
'/soap',
soap(this.quickbooksController, {
overrideRootElement: {
namespace: '',
xmlnsAttributes: [
{
name: 'xmlns',
value: 'http://developer.intuit.com/'
}
]
}
})
);控制器的注释如下:
import { SoapOperation, SoapService } from 'soap-decorators';
import { AuthenticateRequest, AuthenticateResponse } from './model/authenticate.interface';
@SoapService({
portName: 'QBWebConnectorSvcSoap',
serviceName: 'QBWebConnectorSvc',
targetNamespace: 'http://developer.intuit.com/'
})
export class QuickbooksController {
@SoapOperation(AuthenticateResponse)
authenticate(data: AuthenticateRequest, res: (res: AuthenticateResponse) => any): void {
res({ authenticateResult: { string: ['', 'NVU'] } });
}
}我的请求和响应对象被修饰为XSD类型:
import { XSDComplexType, XSDElement } from 'soap-decorators';
@XSDComplexType
export class AuthenticateRequest {
@XSDElement
strUserName: string;
@XSDElement
strPassword: string;
}
@XSDComplexType
class AuthenticateResult {
@XSDElement({ type: 'string' })
string: string[];
}
@XSDComplexType({ name: 'authenticateResponse' })
export class AuthenticateResponse {
@XSDElement
authenticateResult: AuthenticateResult;
}https://stackoverflow.com/questions/50962718
复制相似问题