Spring Boot SOAP Web服务(服务WSDL中是否存在?)

时间:2018-10-23 17:43:18

标签: java spring-boot soap

我集成了付款系统。我有一个wsdl文件。我将这个wsdl文件分割成一个Jaxb库,然后进行了必要的设置。我将在soap服务上使用一个发布过程来编写从表单中获取的数据,但是当我发布时会出现错误。

Message part {http://provision.web.tpay.mf.turkcelltech.com/}registerCardRequest was not recognized.  (Does it exist in service WSDL?)

我的代码如下。

型号:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "registerCardRequest", propOrder = {
    "alias",
    "cardToken",
    "eulaId",
    "isDefault",
    "msisdn",
    "otp",
    "otpValidationId",
    "threeDSessionId"
})
@XmlRootElement
public class RegisterCardRequest
    extends BaseInput
{

    protected String alias;
    protected String cardToken;
    protected String eulaId;
    protected Boolean isDefault;
    protected String msisdn;
    protected String otp;
    protected String otpValidationId;
    protected String threeDSessionId;

    /**
     * Gets the value of the alias property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getAlias() {
        return alias;
    }

    /**
     * Sets the value of the alias property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setAlias(String value) {
        this.alias = value;
    }

    /**
     * Gets the value of the cardToken property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCardToken() {
        return cardToken;
    }

    /**
     * Sets the value of the cardToken property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCardToken(String value) {
        this.cardToken = value;
    }

    /**
     * Gets the value of the eulaId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getEulaId() {
        return eulaId;
    }

    /**
     * Sets the value of the eulaId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setEulaId(String value) {
        this.eulaId = value;
    }

    /**
     * Gets the value of the isDefault property.
     * 
     * @return
     *     possible object is
     *     {@link Boolean }
     *     
     */
    public Boolean isIsDefault() {
        return isDefault;
    }

    /**
     * Sets the value of the isDefault property.
     * 
     * @param value
     *     allowed object is
     *     {@link Boolean }
     *     
     */
    public void setIsDefault(Boolean value) {
        this.isDefault = value;
    }

    /**
     * Gets the value of the msisdn property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getMsisdn() {
        return msisdn;
    }

    /**
     * Sets the value of the msisdn property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setMsisdn(String value) {
        this.msisdn = value;
    }

    /**
     * Gets the value of the otp property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getOtp() {
        return otp;
    }

    /**
     * Sets the value of the otp property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setOtp(String value) {
        this.otp = value;
    }

    /**
     * Gets the value of the otpValidationId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getOtpValidationId() {
        return otpValidationId;
    }

    /**
     * Sets the value of the otpValidationId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setOtpValidationId(String value) {
        this.otpValidationId = value;
    }

    /**
     * Gets the value of the threeDSessionId property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getThreeDSessionId() {
        return threeDSessionId;
    }

    /**
     * Sets the value of the threeDSessionId property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setThreeDSessionId(String value) {
        this.threeDSessionId = value;
    }

}

配置:

@Configuration
public class config{

    @Autowired
    WebServiceMessageSenderWithAuth webServiceMessageSenderWithAuth;

    private static final String CONTEXT_PATH = "*********";
    private static final String CONTEXT_PATH2 = "com.argedor.servisasistani.iservis.schemas.paycell";

    @Bean
    public Jaxb2Marshaller marshaller() {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
//        String[] packagesToScan= {CONTEXT_PATH, CONTEXT_PATH2};
//        marshaller.setPackagesToScan(packagesToScan);
        marshaller.setContextPaths(CONTEXT_PATH, CONTEXT_PATH2);
        return marshaller;
    }

    @Bean
    public SOAPConnector soapConnector() {
        SOAPConnector client = new SOAPConnector();
        client.setMarshaller(marshaller());
        client.setUnmarshaller(marshaller());
        client.setMessageSender(webServiceMessageSenderWithAuth);
        return client;
    }

    @Bean
    public Card card(Jaxb2Marshaller marshaller){
        Card client = new Card();
        client.setDefaultUri("https://tpay-test.turkcell.com.tr/tpay/provision/services/ws?wsdl");
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        return client;
    }

}

和Post方法:

@PostMapping("/add")
    public RegisterCardResponse newCard(@RequestBody RegisterCardRequest product){
        RegisterCardResponse response = (RegisterCardResponse) getWebServiceTemplate()
                .marshalSendAndReceive("https://tpay-test.turkcell.com.tr/tpay/provision/services/ws?wsdl=registerCard",product);
       return response;
    }

0 个答案:

没有答案